扫码关注官方订阅号
如图,compatibility这个参数似乎是“适应”的意思,这就搞不懂了,压缩个代码还要考虑兼容ie8的吗?
ringa_lee
gulp-clean-css底层用的是clean-css,更多参数可以看clean-css的内容。
gulp-clean-css
clean-css
关于这个参数: 其文档也有说明>>
For example, this declaration --compatibility 'ie8,+units.rem' will ensure IE8 compatiblity while enabling rem units so the following style margin:0px 0rem can be shortened to margin:0, while in pure IE8 mode it can't be.
--compatibility 'ie8,+units.rem'
rem
margin:0px 0rem
margin:0
要考虑。部分 CSS hack 是针对某些版本的浏览器的。例如:
body { _property: value; /* IE6 */ +property: value; /* IE7 */ property: value\0; /* IE6 && IE7 */ }
在你设置 compatibility 为 IE8 时,那上面这些其实是不必要的!
compatibility
这是告诉cleancss压缩时要不要保留IE8及以下兼容写法,写compatibility:'ie7'就是保留ie7兼容写法。。比如zoom:1;这些,不保留它就给你删除了。。压缩插件不仅仅是压缩,还能优化,如果你用gulp-cssnano,还能帮你把多余的类名和属性合并。。等等
gulp-cssnano
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
gulp-clean-css
底层用的是clean-css
,更多参数可以看clean-css
的内容。关于这个参数: 其文档也有说明>>
要考虑。部分 CSS hack 是针对某些版本的浏览器的。例如:
在你设置
compatibility
为 IE8 时,那上面这些其实是不必要的!这是告诉cleancss压缩时要不要保留IE8及以下兼容写法,写compatibility:'ie7'就是保留ie7兼容写法。。比如zoom:1;这些,不保留它就给你删除了。。
压缩插件不仅仅是压缩,还能优化,如果你用
gulp-cssnano
,还能帮你把多余的类名和属性合并。。等等