I'm using RequireJs for structuring my JavaScript code. Also, I'm using a lot of CSS3 and I use "Modernizr w/ YepNope" + x number of css3 polyfills.
I understand "Modernizr w/ YepNope" and RequireJs are both Resource Loaders. Since they are both resource loaders is it a bad idea to use both of them in the same project?
So, basically I'm asking, is it a bad idea to use:
In the same page?
As long as you don't load RequireJS modules via YepNope it is ok to use both. Otherwise you could encounter this issue according to the RequireJS doc : http://requirejs.org/docs/errors.html#mismatch
And since you load stuff outside RequireJS, i.e. an API polyfill, the only way your modules could use those polyfills would be to make the initial require()
call within the complete()
callback of YepNope. But IMHO it gets a bit clunky...
Summary: Respond.js, (which is great with jQuery Mobile), is based on css3 media queries, so if polyfills is all you need, you probably do not 'need' resource loaders.
I cannot speak for YepNopejs, but since respond.js is listed in Modernizer, it seems redundant.
Modernizer, if used, should determine whether or not respond.js is loaded.
Modernizer will conditionally load the scripts, including respond.js, client-side based on feature detects. Supported scripts (which do not currently include YepNope) at
https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills
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