Re:Context Require - Load JS assets based on page content
by untog on Wednesday October 02, 2013 @01:34PM
(#6483922)
I think the benefits of this approach are outweighed by the number of HTTP requests you have to send for individual JS files. In the majority of cases you'll find that all of your JS, bundled up and minified, loads faster than getting each file as it is required.
[ Parent
| on HN ]
Re:Context Require - Load JS assets based on page content
by benjaminbenben on Wednesday October 02, 2013 @01:56PM
(#6484073)
Yeah, there is a bit of an overhead with that. Module server - https://github.com/google/module-server seems like quite a good solution. Though I'd agree, for a large number of sites it's far better to bundle them up.
Re:Context Require - Load JS assets based on page content
by shoebappa on Wednesday October 02, 2013 @06:46PM
(#6485947)
For a large scale website, where not every page would have a video player, gallery, or calendar, why load that JS and CSS, which can be very heavy. The benefits are definitely there without having to declare explicitly that a particular page needs a certain dependency.