Pages: [1]   Go Down
Send this topic | Print
Author Topic: Online CSS Minifier  (Read 530 times)
0 Members and 1 Guest are viewing this topic.
robertwatcher
Alternative Viewpoint
Administrator
Hero Member
*****
Offline Offline

Gender: Male
Posts: 774


Alternative Viewpoint


WWW
« on: February 03, 2010, 08:55:42 AM »

Whenever possible, I prefer to keep my styles sheets compressed to benefit from the smallest file size possible. (I also like to keep most of my styles in one style sheet so that there fewer requests to the server).

Because I use maximum compression with excess white space and comments taken out - I have to keep 2 versions of my style sheet - - - one for easy reading and editing, and then the minified one that I generate after editing is complete. I have been following the popular naming convention of "style.css" for the uncompressed file, and "style-min.css" for my compressed file.

While there are several very good online tools for cleaning up CSS code - some which allow various levels of compression  - - - my needs are simple. And so with that agenda, I threw this script together last night. It isn't complex and doesn't have fancy algorithms. It simply returns the file contents of a particular style sheet url with extra white space and comments removed. A couple of simple safeties are built in that return an error when a url has not been entered, and also when the file extension of the url is not ".css". I also threw in a little bit of Jquery and Javascript code so that the returned code could be selected (cross browser I hope).

MINIFY CSS STYLE SHEETS ONLINE:


-------
« Last Edit: February 03, 2010, 10:05:59 AM by robertwatcher » Logged

Rob

A Creative Edge in Photography by Robert Watcher
www.robertwatcher.com

Contact me at robertwatcher@hotmail.com
Pages: [1]   Go Up
Send this topic | Print
Jump to:  

Little Buddy and the Voice of Reason by Timothy M Watcher

LB by timothy michael watcher is a weekly comic strip that explores the consequences of having the mind of timothy michael watcher