filamentgroup / grunt-criticalcss

Grunt wrapper for criticalcss
MIT License
530 stars 27 forks source link

forceInclude has weird configuration #41

Closed nathraQ closed 1 year ago

nathraQ commented 7 years ago

I'm using the latest version of grunt-criticalcss.

I found some weird behaviour with the forceInclude. I had to include a css selector with the cli of criticacss it looked like this:

node_modules/criticalcss/bin/critical.js -u https://domain.com -o foo.css -f bar.css  --force [.someSelector]

so I guessed that my grunt config should look like this

options: {
          forceInclude: ['.someSelector'],
          url: 'https://domain.com',
          filename: 'bar.css',
          outputfile: 'foo.css'
        }

But after debugging criticalcss used with grunt and CLI I figured out that to get the wanted behaviour (including .someSelector) I had to write the grunt config like this:

options: {
          forceInclude: ['[.someSelector]'],
          url: 'https://domain.com',
          filename: 'bar.css',
          outputfile: 'foo.css'
        }