Note: This plugin uses version 3 of Modernizr. Make sure to check the Github repo for the correct feature names (example:
Modernizr.touch was renamed to
gulp-modernizr as a development dependency:
npm install --save-dev gulp-modernizr
Then, add it to your
var modernizr = ;gulp;
Running the plugin will search for tests in your
src files like this one for example:
if !Modernizrobjectfit ;
and in this case add the 'objectfit' test to the ouptut file.
You can optionally pass a fileName to name the Modernizr file (defaults to
modernizr(/*fileName, */ settings)
You can pass settings as an object. See the customizr repository for valid settings.
The 'settings' object can also be required from a JSON file:
'options': 'setClasses''tests':'webworkers''cssgrid''cssgridlegacy'excludeTests: 'csstransforms3d'
customizr repository for valid settings.See the
glup-modernizr will not output any
Modernizr.js if your
gulp.src does not contain any file,
regardless of the
tests you may have set.
If you only want to output a
Modernizr.js file with some
tests you set, just pass a fake path to
false, setting it to
true suppresses any log output from customizr
Will never be passed to customizr, see the Gulp guidelines. The option to uglify the build goes against guidelines #1 and #3. Thus, this setting has been removed from this plugin. You may use
gulp-uglify to achieve this functionality in Gulp:
Copyright (c) 2020 The Modernizr team Licensed under the MIT license.