Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not to use csso instead of cssmin? #28

Closed
arikon opened this issue Oct 19, 2012 · 7 comments
Closed

Why not to use csso instead of cssmin? #28

arikon opened this issue Oct 19, 2012 · 7 comments
Assignees
Labels

Comments

@arikon
Copy link

arikon commented Oct 19, 2012

csso can make structural optimizations than cssmin can't.
Have a look http://bem.info/tools/csso/

@ghost ghost assigned davglass Oct 19, 2012
@davglass
Copy link
Member

Because we already have cssmin which uses the same logic we used in YUI Compressor.

@arikon
Copy link
Author

arikon commented Oct 20, 2012

@davglass But csso has better compression, you could compare cssmin and csso yourself.

@css
Copy link

css commented Oct 20, 2012

@davglass Sorry, but the difference in logic between ycssmin and csso is the difference between RegExp based compression and AST-transformation compression. I mean, it may be much better to use something new with better results, than to use something known, but a little bit old.

Just one simple sample to compare.

Source:

a {
    color: red
}
a {
    color: red
}

cssmin:

a{color:red}a{color:red}

csso:

a{color:red}

@davglass
Copy link
Member

Sorry, I didn't mean to be short with you. I did compare the two, but I needed a tool that I could trust to not break things and that I could use right away.

Our version of cssmin has 97% code coverage (http://yui.github.com/ycssmin/) and has been the primary compression tool used by YUI for more than 4 years now. To switch to something else that changes the way we compress our CSS was not a move I was willing to make in the very short amount of time that I had.

If you can build your test suite out and show that your compressor is a better choice in the future, then I will judge them again and make that call then. Until then, I have to go with the one that I can trust to do it's job and do it well.

@css
Copy link

css commented Oct 20, 2012

I see. Ok, we will try to do it. Thank you.

@davglass
Copy link
Member

You should also take several CSS files from large OSS projects &
compress them with csso & others to show the compression ratio &
what's saved by using it ;)

@css
Copy link

css commented Oct 20, 2012

We did it many times. :) CSSO is the "good old whitespace killer" + structure compression. So in most (ok, I will not use the word "all") cases it is better, especially for large (something about 100K) CSS files, especially generated by some CSS code generators.

Here is another example to show the difference between compression methods.

Source (updated: sorry, it was old one, here is the new one):

a {
    color: blue;
}
b {
    color: #00f
}

ycssmin test.css:

a{color:blue}b{color:#00f}

csso test.css:

a,b{color:#00f}

Yep, you will not see the huge profit on small styles. There are nothing to compress, just spaces, numbers, colors, etc — old tools are good enough to do it. But try to use it on huge files.

BTW, if you have another example (CSSO is bad, some tool is good), I will be very glad to see it and to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants