purifycss / grunt-purifycss

Remove unused CSS with the grunt build tool
MIT License
163 stars 21 forks source link

Options param not working #7

Closed kangw3n closed 8 years ago

kangw3n commented 9 years ago

Im using sass and compass for my production, here's my code in grunt.

  purifycss: {
      options: {
        minify: true
      },
      target: {
        src: ['dist/**/*.html', 'dist/js/*.js'], // Observed files
        css: ['dev/css/*.css'], // Take all css files into consideration
        dest: 'dist/css/style.css' // Write to this path
      }
    }

CSS can't be minify while i'm running this tasks

paskausks commented 9 years ago

I'm experiencing the same issue.

Well, for now I'm just passing the purified file into grunt-contrib-mincss. It's an extra step alright, but it does the trick.

tpgmartin commented 9 years ago

It looks like a hardcoded options object was being passed to purify instead of the user-defined options

michahell commented 9 years ago

How have you fixed this @tpgmartin ? have no experience building grunt / nodejs tooling :/ disabled this great tool for now, I have the suspicion that some css I need still is getting removed. Together with missing explicit ignore rules that can be set this isn't yet quite optimal for all use-cases.

tpgmartin commented 9 years ago

Hey @michahell I'm not sure I understand. The options parameter relates to the properties defined here https://github.com/purifycss/purifycss#options-optional, none of which explicitly state how much or little CSS should be removed.

This specific fix allows you to pass in the options as desired from your gruntfile.

paskausks commented 9 years ago

For me, setting options as { minify: true } doesn't minify the CSS. I think that was the original point of the issue.

michahell commented 9 years ago

@tpgmartin setting the info parameter to true does not give me a list of CSS that has been removed. This is handy if you know that some CSS rule that you DO need, is getting removed. you can then either:

I think the original point is that the whole passed options object is not being picked up by PurifyCSS.

sjungwirth commented 9 years ago

thanks @tpgmartin for the fix, I guess I'll use your version for now

kennyt commented 8 years ago

This is fixed now. Will be publishing as soon as I get permissions on the grunt-purifycss npm package

Edit: done :100: