I am noticing objectFit is not part of Drupal 8 core/modernizr library. How do I add objectFit detection without overriding core modernizr?


I'm pretty sure you have to override core/modernizr with a later version in order to get objectFit.

  1. Download an updated modernizr.js and include objectFit.
  2. Place the file somewhere in your theme's path (js/ or scripts/)
  3. In your theme's info file (theme-name.info.yml) , override the existing modernizr library
      assets/vendor/modernizr/modernizr.min.js: scripts/modernizr.js

You should now have access to objectFit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.