I’m a programmer. I like to design stuff too, so I have a fair amount of knowledge about CSS. But how do I learn CSS even better?
Well, I stumbled upon this article about css minifier comparison: phpied.com – CSS minifiers comparison
CSS Tidy seemed to be the obvious best choice, so I thought I’d take up the challenge and make my own CSS minifier – based on the Ideas I had when I started to think about the logic behind. That’s where the fun began.
After some hours of work I managed to create a simple CSS minifier with PHP, that still is a way to go to match the capabilities of CSS Tidy, but where I even managed to be better in some cases. I still see a lot of improvement potential on my small script (~13 kb and counting – CSS Tidy is ~100kb), so hopefully the improvements can make my css files even smaller and crush the competition :-p
There is still a long way to alpha version(probably tons of bugs to fix before it’s stable), but when I come to it I’m probably going to put it out there as a web service.
What did I learn so far?
– A lot of CSS tricks!
– How to write CSS with more confidence.
– When shorthand css is favorable (“always” is the wrong answer).
– CSS never really stops being a mess :-p
– You can write very simple css, creating huge css files, and then easily minify and optimize size when in production.
– That the effort of creating very small css from scratch become somewhat pointless.
– How to write CSS the best for optimized minification.