gruntjsgrunt-contrib-cssminclean-css

Use clean-css compatibility options in grunt-contrib-cssmin


I ran into an issue with clean-css in IE10. I'm needing to turn off the spaces after closing braces optimization.

I'm using the grunt-contrib-cssmin plugin to automate all these optimizations, but I don't see a way to access the compatibility flags from within this plugin.

Has anyone been able to target the compatibility settings of clean-css from the grunt-contrib-cssmin plugin?


Solution

  • Ran into this same issue yesterday, and found the solution here: https://github.com/gruntjs/grunt-contrib-cssmin/issues/192. Basically, if you want to turn that off specifically, try this in the cssmin part of your Gruntfile:

    options: {
        compatibility: {
            properties: {
                spaceAfterClosingBrace: true
            }
        }
    }
    

    However, the issue I had was with IE8 not IE10, so I just simply use:

    options: {
        compatibility: 'ie8'
    }
    

    Either way, I hope this helps!