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

JavaScript AngularJS Basics (1.x) Improving Our Todo App Scaffolding Our App

Mike Jensen
Mike Jensen
11,718 Points

Doesn't this structure hurt the performance of the app by increasing the number of http requests?

Is there some way around the performance hit, i.e. a require() like behaviour where the dependencies are detected server side and loaded into a single file to be sent to the client?

1 Answer

akak
akak
29,446 Points

If you have app this size I would say the performance would not suffer. Adding additional step to your workflow, for a small project, is IMHO not worth the effort. But when you have bigger apps of course it's worthwhile to bundle all files into one.

You can use require like syntax with for example Webpack (search internet for webpack + angular 1.x) or you can simply use gulp (there are videos on it on Treehouse) and concat all files together. (I assume webpack can also do just simple concating, but I've never used it that way). By doing so you would get just the same result as including every file in HTML one under another, but concatenated in one file. (and ideally minified for production).