Online CSS compress which doesn't remove IE hacks

ぃ、小莉子 提交于 2019-12-06 04:47:12
Pranav 웃

CSS Compressor and Clean CSS usually work for me, although I prefer to use a different stylesheet for all previous versions of internet explorer. It is usually better to keep previous browser supporting css seprately. Or keep hacks in a seprate file and appened it to the compressed css.

In your case, however, the compressors do remove *

I do not know any online compressors which preserve the hacks, however, I can offer workarounds.

A solution would be to use hacks on selector rather than on attribute. Here are a couple of examples :

* html #uno  { color: red } /*IE6 and below*/
*+html #dos { color: red }  /*IE7*/

Check here about the other hacks available : http://paulirish.com/2009/browser-specific-css-hacks/

If that does not work for you another workaround, might be a little tiresome, but before compression, add some unique value before a hack like

#uno {#HACK#display:inline;}

and then after compression using a text editor replace all #HACK# with *

This one worked for me using your test code - http://www.cssdrive.com/index.php/main/csscompressor

As did - http://iceyboard.no-ip.org/projects/css_compressor, http://www.refresh-sf.com/yui/ and http://tools.arantius.com/css-compressor

It might be worth googling your question before you actually post it on here. I did a search for "css compressor", opened the first 6 results and found those four all compressed your code without removing any of the hacks.

stackoverflow isn't supposed to be used to ask something you're too lazy to search for yourself.

Vladimir Starkov

Any of these four five online minifiers do their work in way you satisfied

And also a smart tool (developed and used by russian Yandex) has both online and back-end versions

Try Devilo.us, which is based on CSSTidy. You can select exactly how much it compresses and how.

http://css.github.com/csso/csso.html — this one worked for me. It is not only trim unused symbols, but also remove duplicate rules, and group selector if in help's make size smaller.

It is online version of following tool: https://github.com/css/csso

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