Javascript CSS Formatter
Posted by stephen on February 17th, 2009I’ll probably post more on this later, but I just want to get it up for now.
Sometimes my CSS gets auto-formatted, which adds a whole bunch of “clutter” space that I don’t want. I find CSS easier to read when there is a visual hierarchy of the selectors and the HTML elements they represent, and if there is consistency in the order of the selector attributes.
The following CSS Formatter will place all of your selectors and their contents on a single line, and sort their attributes alphabetically.
For instance…
div#whatever, div.whatnot {
display:block;
background:transparent;
float:left;
}
becomes…
div#whatever,
div.whatnot {background:transparent; display:block; float:left;}
The formatter will IGNORE any space outside of the selector and its contents.
Try it out here:
http://blog.stephenrushing.com/wp-content/uploads/2009/02/cssFormat/cssformat.html
Recent Comments