Modernizr/Modernizr — pull request #967 by doctyper (2013-06-04 18:26:28+00:00)
Title: Programmatic API

This PR introduces a programmatic API first proposed in #958, and with it a `build` method to generate customized Modernizr builds. Usage:

```javascript
var modernizr = require("modernizr");

var result = modernizr.build({
"feature-detects": ["test/css/flexbox"]
}, function (result) {
console.log(result.code); // full source
console.log(result.min); // minfied output
});
```
The first parameter takes a JSON object of options and feature-detects to include. See `lib/config-all.json` for all available options.

The second parameter is a function invoked on task completion. It returns an object with both the full source and minified output.

The API is extensible (see `lib/cli.js`), allowing you to attach and expose more methods if necessary.

Tests included.