Reputation: 69
I'm trying to use Modernizr for the first time, and I'm having trouble getting it to add a class to the HTML tag per the Docs.
I used Modernizr's build feature to generate a custom js file to test compatibility for the CSS Object Fit property. I added the file, called modernizr-custom.js
, to my Javascript directory and, using Gulp, am loading it via my gulpfile. Now when I refresh and open chrome dev tools I see that the HTML tag now has an empty class: class=" "
instead of class="object-fit"
. This tells me that Modernizr is doing something, but obviously this isn't correct.
I have the modernizr-config.json
in my root, which is set as follows:
{
"minify": true,
"options": [
"setClasses"
],
"feature-detects": [
"css/objectfit"
]
}
Should I be loading any additional Modernizr js files for this to work properly? Any insight would be wonderful, as I'm sure I'm just not fully understanding how to set it up.
Upvotes: 2
Views: 378
Reputation: 69
SOLUTION: using the minified file was causing the issue. After the replacing the file with a non-minified file, everything works as expected.
Upvotes: 1