CSS Tools Coda Plugin
Update: CSS Tools is no longer maintained by me and is available on GitHub.
I’ve been using Coda on a more consistent basis lately, primarily due to the inclusion of third party plugins. As I work, I’ll find myself missing a few features from TextMate bundles. Since it’s terribly easy to write your own Coda plugin, I’m going to make a consistent effort to write and maintain a small library of plugins over the coming months.
My latest plugin finds its roots in an article I wrote not too long ago; CSS Organization Methods and Writing Style. In the article, I took a quick look at a small rift that brought up quite a bit of conversation in the Web community. There are two distinct camps, it seems, when it comes to people who write CSS. There is one side that writes their CSS properties on a single line, and another that will devote a line to each property in a selector. Personally I’m in the ‘single line’ camp, but I absolutely understand why other authors prefer multi line.
I came up with a proposed solution; reformat your CSS. That tool uses CSSTidy to allow a simple transformation of your CSS formatting. It will retain any comments, and leaves all properties as written (instead of converting to shorthand, for example.)
Basically, CSS Tools brings that functionality to Coda. You’re able to convert a style sheet from single line to multi line and vice versa. You’re also able to compress your CSS if you’d like. Take a look:
I plan on making the plugin more elaborate over the coming weeks, hopefully beefing up the template which handles reformatting, as well as providing more methods for compression, possibly the ability to include your own CSSTidy template for processing.