Modernizr Command Line Interface

Modernizr is an an excellent library used for client-side feature detection.

Modernizr

The full set of features detected can be obtained using its development version, however, including this entire file is not ideal in production - why make users download all the extra code for feature detection tests that will not ever be used?

Thankfully, Modernizr has a nifty download feature, which lets you fill in a form to select which tests you want, and then it generates a customised file for you to download.

How about a CLI?

Modernizr + Command Line = ?

That is great, however, what if you want to use Modernizr to generate custom files on the command line?

I came across this closed ticket raised against Modernizr, and that helped somewhat, as I found a way to generate custom files on the command line, but the command I had to issue was extremely convoluted.

Seeking an easier way, I came up with this, which was a huge improvement in usability.

Now it is even easier:

    npm install -g modernizr-cli
    modernizr custom.json

(Where custom.json should conform to this format)

Check it out: modernizr-cli on github | modernizr-cli on npm

Copyright © 2008-present Brendan Graetz