Loading my ember CLI app currently involved downloading a 3Mb file, most of which consists of common libraries such as jquery, ember, bootstrap, etc. 3Mb is not huge, but it becomes noticable over a slow connection so I want to strip out all the common libraries and get them from a CDN instead. The idea is that they would be cached by the browser to that they don't need to be re-downloaded every time I update my app (which is very often at the moment). I have read this question, which points out that it is easy to simply add a <script...>
to index.html, but I can't figure out how to them tell ember not to package those libraries into vendor.js.
In brocfile.js
(ember-cli-build.js
in newer versions) change the constructor to
var app = new EmberApp({
vendorFiles: {
'jquery.js': false,
'handlebars.js': false,
'ember.js': false
}
});
Now include those in your index.html the old fashion way and enjoy the fact that pretty much every users browser already has jquery cached even if they haven't visited your site before.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With