FamousArchives / generator-famous

for those who hate doing things once
123 stars 26 forks source link

How do I include Modernizr so that it will work in the dist version? #47

Open vikeri opened 9 years ago

vikeri commented 9 years ago

I wan't to use Modernizr to determine if the client can run famo.us, I therefore downloaded a beta version of Modernizer as suggested here: http://stackoverflow.com/questions/25261412/detect-whether-the-browser-supports-famo-us

I saved that to src/modernizr.js and added it so the top of my main.js looks like this:

 /* globals define */
define(function(require, exports, module) {
    'use strict';
     require(['modernizr'],function(){
        if(!Modernizr.testAllProps('transformStyle', 'preserve-3d')){ //Send user to static if Famo.us not supported
            window.location.replace("/components/1.html");
        }
 });

This works well when I use the dev version grunt serve, but fails to load when I use only grunt to generate the production version. Any ideas why?

The error I get in the console is the following:

Error: undefined missing modernizr