Search code examples
htmlcssmedia-queriesmodernizrrespond.js

Do I still have to manually include matchmedia.js and respond.js with modernizr?


The question is basically in the title: will the modernizr build tool include respond.js and/or matchmedia.js when I select media queries to be included (under extra)?

Or do I have to include it manually with Modernizr.load? (I've looked at the source, but I can't really tell whether respond.js is in there)


Solution

  • If you select the "Media Queries" option under "Extra" in the build tool, your Modernizr build will include a matchmedia.js-like function called Modernizr.mq() (see the documentation). The code's basically the same as matchmedia as both were written by Paul Irish.

    Respond.js isn't included in Modernizr, but Initializr can create an HTML5 Boilerplate build which includes Modernizr and Respond.js.