Add custom modernizr to Sage 9

Try and search the forum and you would have found this thread and solution:

Tweak the following steps to use it in Sage 9:

  1. Save the modernizr-config.json file in your resources/assets/scripts/ directory.
  2. Browse to: resources/assets/scripts/ and run:
modernizr -c modernizr-config.json
  1. Add the in step 5 generated modernizr script to your dependencies in the assets/config.json like this:
  "entry": {
    "main": [
    "modernizr": [
    "customizer": [
  "publicPath": "/app/themes/sage",
  "devUrl": "http://example.test",
  "proxyUrl": "http://localhost:3000",
  "cacheBusting": "[name]_[hash:8]",
  "watch": [
  1. Run yarn build
  2. Enqueue your modernizr script in app/setup.php before sage/main.js:
wp_enqueue_script('sage/modernizr.js', asset_path('scripts/modernizr.js'), [], null, true);