slushjs / slush-angular

A slush generator for AngularJS using the Google Angular App Structure Recommendations
129 stars 32 forks source link

Why combine partials? #36

Closed stubbies closed 10 years ago

stubbies commented 10 years ago

I don't understand why does slush-angular combines all partials and puts them in main app.js file as $templateCache?

Most apps have tens of partials, some have static content and it would be bad practice to load them all when you don't need them.

joakimbeng commented 10 years ago

It's made like that to minimize the number of requests to the server. Yes, the initial page load is a little bigger but you'll have the complete app cached in the browser after that. A complete, and quite big, single page application with html, css and javascript is still quite small when compared to all those widescreen full page images that's trendy these days.

When AngularJS has implemented real partial loading of application modules, then I wouldn't precompile the templates into $templateCache, but until then I still see this as a good practice.