[SIZE=3]I am working to implement Modernizr for the first time and I need help with questions about polyfill management.
I am trying to parse various instructions from H5BP and Modernizr tutorials regarding combining JS files onto one document, concatenating + minifying, and script loading via Modernizr.
-
Is it still useful or needed to combine scripts into one file if they are being loaded by Modernizr?
-
Would putting all of the files into one document cause Modernizer to load all of the scripts every time, just to get to the one needed?
-
Can you show an example of combining two scripts on one page manually? Every tutorial says “too hard - use a concatenator” and skips over the visual of what a javascript mashup looks like. What does it look like to string an array of JavaScripts together? Maybe this is so basic but I cannot find such a visual example.
-
If many plugins are combined within one JS file, what is an example of the path to each specific JavaScript file to type into the Modernizr.load script?
Something like
js/plugins.js/polyfill-1.js
(?) or only
js/plugins.js
and they are all loaded (?)
-
Is it better to just keep related JS files in a folder and let Modernizr load them separately? Is there any loss of loading speed that way?
-
If I am loading JQuery Plugins via Modernizr, do I also still need to add them in Modernizr using a
(function($){ ... })(jQuery);
closure to make sure they’re in the jQuery namespace, as H5BP suggests? What does that pattern look like?
- If I do keep each JS file separate for development, and then concatenate them for launch, do I then need to change the Modernizr.load script?
Thanks. :)[/SIZE]