Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Carl Mungazi
Carl Mungazi
9,071 Points

Injecting JS files into files served up via a framework

Hello,

I have a question about frameworks which I am sure probably has a simple answer but I've not been able to crack it yet.

I've got a bunch of simple one page websites I want to manage via a framework so they can all have the same header etc and so I can avoid repeating code.

I tried to do this with AngularJS yesterday but I had an issue injecting JS scripts into individual files. I am using the sites to practice various aspects of JS so each site has its own JS script file(s). I know injecting JS scripts into Angular files is not easily done but I do not know JS well enough (yet) to code the work around.

Is there another JS or PHP framework which allows JS files to be injected easily? I've got some experience with SlimPHP via Treehouse but I cannot figure it out.

Is anyone able to shed some light?