Skip to content

Upgrading Modernizr in the Framework

Jim Reevior edited this page Aug 14, 2018 · 1 revision

Upgrading Modernizr in the Framework

When a new version of Modernizr is available, the update will not automatically be pulled into the framework. This should be a deliberate action with proper testing. Modernizr is controlled with Grunt. Here are the steps to update Modernizr in the framework:

1. Check for a package update

npm update grunt-modernizr

What this does: Checks if the grunt-modernizr package has an available update and installs it.

2. Upgrade Modernizr using Grunt

grunt upgrade_modernizr

What this does:

  • Generates a new Modernizr build based on the defined tests array in the modernizr function in the framework's Gruntfile.js file.
  • Copies this file to the js/vendor folder.
  • Runs uglify to generate a minimized version of the new build.
  • Changes the RESPONSIVE_MODERNIZR_VERSION constant to reflect the value of the new Modernizr build.

3. Commit Changed Files

These are the files that will potentially be changed and need to be committed to the repository:

  • package.json (if the grunt-modernizr package has an update).
  • package-lock.json (if the grunt-modernizr package has an update).
  • functions.php (the updated Modernizr constant value).
  • js/vendor/modernizr.js
  • js/vendor/modernizr.min.js

Notes

Unchanged Version

A new Modernizr build may need to be generated even if Modernizr itself does not have a new version. For example, a new test may need to be added to the framework's build. When this is the case, you will need to manually change the RESPONSIVE_MODERNIZR_VERSION version after completing step 2.

When this situation comes up, the GitHub task number should be added to the end of the Modernizr version.

Example: Modernizr version 3.6.0 is in the theme. There is no update to Modernizr. The cryptography check needs to be added to the framework's build.

The RESPONSIVE_MODERNIZR_VERSION constant's value should be changed to 3.6.0-### where ### is the GitHub issue number describing the changes being made to the framework's build.

Why This Is Important

Ensuring the version number is different is needed to ensure that all users receive the new build when it is deployed. This is known as a method of cache busting.

Welcome to Responsive!

Get started

Configuration

Build child themes

Sass

Javascript

PHP

Shortcodes

Templates

GitHub

Tasks

Contribute to the framework

Code Examples

BU Developer Resources

Clone this wiki locally