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

流过昼夜 提交于 2019-12-23 04:27:03

问题


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?


回答1:


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!



来源:https://stackoverflow.com/questions/29828059/use-clean-css-compatibility-options-in-grunt-contrib-cssmin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!