fat / smoosh

something like a himalountain.
342 stars 21 forks source link

css compression #5

Closed paolochiodi closed 13 years ago

paolochiodi commented 13 years ago

Hi, is support for css compression planned anytime in the future?

fat commented 13 years ago

Yes -- this is something we've wanted to add. Currently, Smoosh will bundle your css and do size comparisons (just no minification) -- if you have any recommendations for a good compressor, i'd happy to hear them. Cheers!

ded commented 13 years ago

i think yui compressor is as good as any. you don't want it to obfuscate, and it does the normal stuff..

ded commented 13 years ago

i'll take this task.

fat commented 13 years ago

i came across this a while back -- might be a good place to start... https://github.com/fmarcia/UglifyCSS

ded commented 13 years ago

@fat I saw that. It was just a port of YUI. He doesn't appear to be part of the actual Uglify team (kind of a knock-off actually). I spent some time writing my own, actually (hehe ;)

Currently it's embedded in smoosh but I'll take some time to port it out into a separate project that smoosh can require as a dependency.

I've tested it against some pretty intense css cases and some of twitter's own mess of CSS. It turns out to be exactly on par with the numbers output from YUI compressor. It also preserves copyright comments in /! bla /

Anyhow, you can install the latest smoosh:

$ npm install smoosh

then go ahead with your normal life in your config files...

"CSS": {
  "DIST_DIR": "dist",
  "styles": ["./src/bar.css", "./src/foo.css"]
}
paolochiodi commented 13 years ago

great!