Modernizr/Modernizr — Issue #401: Include modulizr.js in public tree
Author: idangazit
Created: 2011-11-02 10:02:23+00:00
State: open

I'm trying to figure out the logic for producing a custom build for any arbitrary set of features, so as to implement it as a server-side builder in Django. That would enable me to store all of modernizr on my server, and allow my template authors to generate custom builds as they need with a syntax like `{% modernizr iepp font-face cssgradients %}`, and cache those builds on the fly.

After poking around the builder a bit, I divined the location of the [uncompressed modulizr.js](http://www.modernizr.com/i/js/modulizr.js), which seems to include the logic for generating custom builds.

It'd be useful to have this logic (or better yet, documentation thereof) in the Modernizr repo. WIthout it, projects like mine have to guess at the correct process, which is brittle and yucky. Also, reverse engineering logic from code is difficult and failure-prone.

Right now, the builder exposes the following toggles:

* CSS3: 19 features
* HTML5: 17 features
* Misc: 7 features
* Extra: 5 features
* Extensibility: 8 features

My best understanding thus far is that handling of these isn't uniform.

* Some disabled tests will result in code stripped out of modernizr.js with a regex (looking for things between comments like ">>featurename").
* Other features are optionally pulled in from files in /feature-detects (not sure where this happens). It appears that 2.1 is moving towards more tests in external files, and less in modernizr.js itself (which seems sensible to me).