How will Snap! Websites Minify CSS files?

I looked around for a while and completely missed the fact that SASS actually offers an extension to compile CSS files from a C++ library. That being said, it was not really clear whether the feat still requires the Ruby scripting language running in the background. If so, I think that my solution: CSS Preprocessor, is going to be a lot faster and possibly easier to maintain long term.

Yes. The CSS Preprocessor project reads .scss files (i.e. files mostly compatible with SASS) and compiles them in CSS 3 that your browser can handle. Not only that, it will minify those files as much as possible by transforming any input data into the smallest possible representation.

The minification is done by the Content plugin backend. Whenever it detects that a new CSS or SCSS file was uploaded to the website, it reads that file, compiles it, and spits out the result as a .min.css file that is further compressed with gzip (using -9 to compress the result as much as possible.)

From my tests on a CSS file of about 78Kb, I got the gzip file down to under 10Kb. The 78Kb compressed with gzip would be a little over 12Kb. So we still have a saving of 20% which is huge when you think that websites that are hit by millions of users would save 20% of bandwidth on all their CSS files.

This won't be the only optimization since later we will look into merging all those files and possibly putting part of them in the HTML too. But at this point, this saving is already quite marvelous.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly