My application is salable. currently we identify 200 screen in my application. In single page application we need to dump all the templates and js file in one request then initial loading takes more time to render page. is there any standard way to handle this?
Asked
Active
Viewed 109 times
-1
-
Why do you need to dump all the templates in a single call? Surely you can separate out the templates and load them on demand. You could use something like Require.js for that. I do a different technique where I use Backbone.LayoutManager https://github.com/tbranyen/backbone.layoutmanager to have my templates on the server, and fetch them on-demand. – stevethethread Nov 12 '14 at 09:08
-
1I do something similar, my application uses require.js, i then minify and concat all js and tempaltes into one file using grunt, i then use cache manifest to have this kept locally once downloaded by the client so apart from the first load all other loads are the quickest they could be. Any time we have an update we re build, update the manifest (part of the grunt build process) and that causes the client to re download the file. – Quince Nov 12 '14 at 12:23
1 Answers
0
Simple!
Don't dump all templates & js file in one request. Use ajax to fetch them as & when required.
I personally prefer using requirejs

coding_idiot
- 13,526
- 10
- 65
- 116