I have tried to create a build with the setting classPrefix: 'has-' from gulp, but the setting doesn't work, and as the gulp-modernizr is really just passing in the config to customizr, I write the issue here:
- The crawler doesn't find any properties
has-xxx, so correct tests are not initialized.
- The prefix is never passed on to the Modernizr script.
I did some digging and it seems that the legacy property cssprefix is still used in the code:
// customizr/src/crawler.js line 57
// (method findStringMatches)
prefix = settings.cssprefix || '';
Hence I need to pass in cssprefix: 'has-' instead of classPrefix: 'has-' before it works, but that contradicts the fact that the property name has been changed to classPrefix (see #8).
If I change the line indicated to prefix = settings.classPrefix || '' the crawler finds the correct properties with the has- prefix.
But unfortunately the prefix is still not passed on to the final Modernizr script and right now I have no precise idea why.
Below is the Gulp setting I have used:
return gulp.src([path.resolve('.tmp/index.css'), path.resolve('.tmp/index.js')])
.pipe(modernizr({
"classPrefix": "has-",
"options": [ "html5printshiv", "html5shiv", "setClasses" ],
}))
.pipe(uglify())
.pipe(gulp.dest(config.destination));
As a side note; I think it is a bit strange that setClasses is not added to the default list of options, as personally I have never used Modernizr without wanting to use the classes as well.
Related issues
Modernizr/grunt-modernizr#30
#8
I have tried to create a build with the setting
classPrefix: 'has-'from gulp, but the setting doesn't work, and as the gulp-modernizr is really just passing in the config to customizr, I write the issue here:has-xxx, so correct tests are not initialized.I did some digging and it seems that the legacy property
cssprefixis still used in the code:Hence I need to pass in
cssprefix: 'has-'instead ofclassPrefix: 'has-'before it works, but that contradicts the fact that the property name has been changed toclassPrefix(see #8).If I change the line indicated to
prefix = settings.classPrefix || ''the crawler finds the correct properties with thehas-prefix.But unfortunately the prefix is still not passed on to the final Modernizr script and right now I have no precise idea why.
Below is the Gulp setting I have used:
As a side note; I think it is a bit strange that
setClassesis not added to the default list of options, as personally I have never used Modernizr without wanting to use the classes as well.Related issues
Modernizr/grunt-modernizr#30
#8