ianllewellyn / modernizr-brunch

Adds automatic modernizr builds to brunch
3 stars 1 forks source link

Does not add modernizr to destination #1

Closed webdif closed 8 years ago

webdif commented 8 years ago

Sorry to ask such a stupid question, but I was excited to see a brunch plugin for modernizr, and nothing happens when I try it :(

I add this config:

plugins:
        modernizr:
            destination: 'js/app.js'
            tests: [
                'csscalc'
                'cssanimations'
                'csstransforms3d'
            ]

But nothing is added to my app.js. Am I doing something wrong? Thanks for your help.

ianllewellyn commented 8 years ago

@webdif The plugin will not append to an existing js file (it doesn't try to, but it might overwrite your actual app.js). Usually you would want to create a modernizr.js that you can add to your .

Try changing to this and looking for js/modernizr.js in your public dir.

plugins:
        modernizr:
            destination: 'js/modernizr.js'
            tests: [
                'csscalc'
                'cssanimations'
                'csstransforms3d'
            ]

If you still have problems could you provide some more information please? (node version, brunch version, OS, etc).

webdif commented 8 years ago

OK, I misunderstood. Thanks!

ianllewellyn commented 8 years ago

Great! There are two reasons it works like this:

  1. The plugin works by scanning your generated js and css files to see what modernizr hooks you have actually used, so it probably wouldn't want to then modify one of those files. That means you shouldn't need to list modernizr tests in your config.coffee like in your example - if you use a test somewhere in your code, then the plugin should find and add them for you automatically.
  2. (The main reason) Usually you want to add modernizr.js to your because of html5 shiv and classes added to causing DOM paints if css has rendered before modernizr.js executes.