What are the scenarios when you want to use CDN to load a javascript file? And which files you might want to lazy load. Or perhaps which scripts are the best candidate to be combined and minified?
for example:
jquery + jquery plugins - should these be accessed via CDN or better to combine/minify them as one to be accessed by just one request
angularjs modules - is it better to lazy load modules as needed or just combine/minify them all at once upon deployment so all modules are actually available to the application at any time
Let me know your idea on this
This question is kind of subjective, but here's my opinion.
CDN's are great because:
Issues with CDN's:
window.angular
Combining is great because:
In short, use cdns when you can for common scripts such as angular, jquery etc and then use combining and minification for your own custom scripts. You should try to aim to only have one request for your own scripts.
If you have a huge amount of javascript then you should consider lazy loading of your scripts to reduce the initial loading time of you site.
I'm working on a jQuery plugin that does not have a selector. When initializing it, I instanciate an object that has functions. In these functions, I need to use closures. In these closures, I would ...
I'm working on a jQuery plugin that does not have a selector. When initializing it, I instanciate an object that has functions. In these functions, I need to use closures. In these closures, I would ...
I need to store client side data temporarily. The data will be trashed on refresh or redirect. What is the best way to store the data? using javascript by putting the data inside a variable var data ...
I need to store client side data temporarily. The data will be trashed on refresh or redirect. What is the best way to store the data? using javascript by putting the data inside a variable var data ...
Is there any time when var result = !value ? null : value[0]; would not be equivalent to var result = value ? value[0] : null;
Is there any time when var result = !value ? null : value[0]; would not be equivalent to var result = value ? value[0] : null;
So I have a data.table object that is being outputed like this: gender hair-color pets group1.totals group2.totals group3.totals F black Y 10 0 ...
So I have a data.table object that is being outputed like this: gender hair-color pets group1.totals group2.totals group3.totals F black Y 10 0 ...