Search code examples
modernizrjspm

Install Modernizr with jspm?


Im trying to install Modernizr in my project with JSPM but I cant seem to find any documentation on this.

Ive tried both jspm install modernizr and jspm install npm:modernizr. Both download the Modernizr files but then I cant load it into my page.

Ive tried this in my main JS file but I keep getting a node error when I try and compile as it cant find the right files.

import  'modernizr'; 

import Modernizr from 'modernizr'; 
new Modernizr;

As I understand JSPM is a pollyfill that allows you to use ES6's module imports. Can Modernizr be imported as a module?


Solution

  • As Modernizr needs to run in the head I dont think its possible to use JSPM for this. Im going to use gulp modernizr instead:

    https://github.com/doctyper/gulp-modernizr