lundi 22 décembre 2014

On single-page applications, is it a good idea to inline everything (including external libraries like jQuery, etc)? [on hold]

The rationale in separating CSS in .css files and Javascript in .js files is (I think) that they may be cached and subsequent pages will load faster because of this.


However, in single-page apps there are no subsequent pages (strictly speaking, i.e. really only one page with views and sub-views), and in the amazing scenario where it's a static page (that later interacts with an API to get some of it's content), we could inline literally everything so that requests for other assets (like CSS, JS and SVG) are minimized and there's only one request to be done to load the entire page.


It would be a big page (probably >2MB if we inline jQuery, Angular and maybe other beefy scripts, Bootstrap CSS) but maybe gzip compression could bring it down to an acceptable size.


Does this make sense ? Could it be a good idea ? Could pages load and render faster if everything was inlined ?


(I'm ignoring the benefit that when using assets from a public CDN like cdnjs.com, visitors could already have popular scripts in cache because they loaded them in other websites)





Aucun commentaire:

Enregistrer un commentaire