Community Documentation

Installing Modernizr module and JavaScript library

Last updated May 17, 2013. Created by rupl on February 10, 2013.
Log in to edit this page.

Modernizr is not GPLv2, and therefore cannot ship within Drupal modules. Since the Modernizr module depends on the upstream JavaScript library, you cannot simply enable the module and expect it to work. Just like a WYSIWYG module or jQuery Update, you must upload your own copy of the JS file after uploading the module to your server.

Drush (easiest)

The best and easiest way to install Modernizr is to use drush, the command-line tool for Drupal.

drush en modernizr -y

This will enable the Modernizr module and automatically download a development copy of modernizr.js. If you'd like to replace your current file, delete it and run the following command:

drush mdl

Drush can detect whether or not you're using the Libraries API and place the file in the correct location within your Drupal codebase. Its default location is where Libraries looks anyway:

  • Libraries enabled: sites/all/libraries/modernizr
  • Libraries disabled: sites/all/modules/modernizr/js will be deprecated as of 7.x-3.2

Without Drush

If you are unable or unwilling to use Drush, you'll have to go to modernizr.com, get the file from the site, and upload it to sites/all/libraries/modernizr