Creating a custom build of Modernizr based on your Drupal setup

Last updated on
8 September 2016

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

When your site is ready to go live, you'll want to take inventory of which feature tests you used, and reduce your Modernizr JS library to include only those tests that you need. This way it is as small as possible, downloading and executing more quickly than it would with unused feature detections present and firing.

The Modernizr module has you covered; it keeps track of all the tests being requested by other modules and themes — just visit admin/config/development/modernizr. There are three sources: modules, themes, and tests within your current copy of modernizr.js.

There's a link to download the exact custom build described on the config page, pictured here:


An image of the Modernizr module's custom build screen.


The button will link to modernizr.com/download/, allowing you to customize your copy of Modernizr before downloading the file. Once downloaded or copied to your clipboard, it will need to be placed at sites/all/libraries/modernizr.

After placing the library in the correct location, you should be able to reload the Modernizr configuration page and see an updated list reflecting any customizations you made once you were on the Modernizr download page.

Missing tests/utilities

As of 7.x-3.3, the module will report when it cannot find required tests or utilities within your current custom build of Modernizr. The missing tests are highlighted red and display the word (missing) after their name. Here is a sample screenshot of a custom build that is missing flexbox and load:

Sample screenshot demonstrating how the admin interface displays missing tests and utilities

Help improve this page

Page status: No known problems

You can: