Is there an advanced CSS minifier/compiler that does things like strip redundancy and comma separate identical rules?

后端 未结 11 1803
暗喜
暗喜 2020-12-09 03:22

For example

input{margin:0}body{margin:0;background:white}

would be shorter written like this

input,body{margin:0}body{back         


        
11条回答
  •  生来不讨喜
    2020-12-09 04:00

    Yes, there is. The YUI Compressor does this for you. I was wrong, the YUI Compressor is only a minifier, but indeed very useful. What and how they minify is presented here.

    This is a .jar package that you'll have to download and then run through the terminal, if you're on Unix or Linux (I don't know about Windows, so someone fill this gap!), with the following syntax:

    $ java -jar /path/to/yuicompressor-x.y.z.jar myfile.css -o myfile-min.css
    

    The -o option declares what file you wish to write your minified content to.

提交回复
热议问题