Why was Modernizr removed?

Was modernizr removed from 8.3.0 to make Sage more lightweight and to let the developer decide whether to include it or not? I always thought this should be included as standard like it is in HTML5 Boilerplate?

noob

I think they removed it because IE8 is no longer supported and it’s easy to re-add it yourself:

1 Like

OK thanks @Twansparant

So, to try and add modernizr back in I have

  1. run $ bower install --save modernizr

  2. checked in bower.json file that the following exists:

ā€œdependenciesā€: {
ā€œmodernizrā€: ā€œ~3.2.0ā€
},

  1. added:

ā€œoverridesā€: {
ā€œmodernizrā€: {
ā€œmainā€: ā€œ./modernizr.jsā€
}

I only added the above because thats how my bower.json looked in Sage before modernizr was removed.

  1. Updates manifest.json:

ā€œjquery.jsā€: {
ā€œbowerā€: [ā€œjqueryā€]
},
ā€œmodernizr.jsā€: {
ā€œbowerā€: [ā€œmodernizrā€]
}

Again because this is how it looked previously (!)

  1. added the enque script on lib/setup.php

wp_enqueue_script(ā€˜modernizr’, Assets\asset_path(ā€˜scripts/modernizr.js’), [], null, true);

Again, as previous

  1. run $ gulp

But modernizr still doesnt exist : ā€œReferenceError: Modernizr is not definedā€ in firebug

So I checked the bower_components/modernizr and there is no modernizr.js, but there is a grunt file… Am I supposed to run ā€œgruntā€ inside bower_components/modernizr to create the modernizr.js file?

I haven’t done this yet because I thought we werent supposed to touch files inside bower_components?

@Twansparant any ideas? Or anyone else? :grin:

That should work!
I have exactly the same in my bower.json:

"overrides": {
    "modernizr": {
      "main": [
        "./modernizr.js"
      ]
    }
}

and manifest.json:

    "modernizr.js": {
      "bower": ["modernizr"]
    },

But with version 2.8.2, maybe that’s the difference, because I do have a modernizr.js file in there?

yeah i’ve been trying to fold modernizr back into sage for the last few weeks. tried everything here and so far nothing has been working.

Come on guys, have you been to the Modernizr website since version 3 launched? It’s completely different now. There is no base pre-compiled version with all the options selected anymore. The docs tell you that you need to either run modernizr from the command line or run their grunt script.

This workflow obviously hasn’t been tested with Sage because it was removed back in Modernizr v2 days, this is the new v3 workflow.

If you want the old drop-in Modernizr workflow that Sage used to have, just set Bower to get the latest Modernizr v2 build, which looks like v2.8.3

oops

To be honest, there are so many different things to learn in trellis, bedrock, sage, that if something breaks or doesn’t work I always assume its something I’ve done wrong!

I ended up grabing a copy of modernizr 2.8.3 of a html5 boilerplate and using manifest.json to pull it in.

Ive come to Sage post grunt and skipped that whole thing. Man, too many workflows not enough time to learn them all AND get the jobs you are paid to do completed.

2 Likes

Yep, if you’re jumping in to all 3 at once, that is a ton of stuff to learn. Glad you’re figuring it out though :smiley:

1 Like

yeah step by step… somethings are just kinda like - ok that works, dont touch that! This is broken, so try all the things until it either breaks some more or works.

No method, just madness! :scream: