Building your own custom Modernizr

It was while implementing version 1.0 of Alex Santon's clever Yepnope polyfill that I realised you could actually customise Modernizr to use just the features you need in your site. Really neat: here's how to do it.

The cool bit is that Modernizr also provides you with a JavaScript API that can tell you whether or not a feature is available, including a few features that don’t show up in the <html> tag classes

[...]

There’s still a slight problem here, though. If a browser does support the placeholder attribute, I’m still requiring it to download a bunch of code that does nothing but emulate that attribute’s behavior. I’m sure you’ll agree this is a little wasteful! Enter yepnope.js. Yepnope loads scripts if certain conditions are met. The best part is that it integrates beautifully with Modernizr, so everything just snaps into place.

[...]

The new custom Modernizr builder allows you to bundle yepnope right into Modernizr, so let’s do that. Head over to http://modernizr.github.com/Modernizr/2.0-beta/. [...] Click Generate, and then Download Build to grab your custom Modernizr library.