<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Monday By Noon &#187; CSSTidy</title>
	<atom:link href="http://mondaybynoon.com/tag/csstidy/feed/" rel="self" type="application/rss+xml" />
	<link>http://mondaybynoon.com</link>
	<description>A resource for Web designers and developers to read about and discuss their craft.</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:49:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>&#8226; CSS Tools Coda Plugin</title>
		<link>http://mondaybynoon.com/feeder/?FeederAction=clicked&#038;feed=Posts+%28RSS2%29&#038;seed=http%3A%2F%2Fmondaybynoon.com%2F20081215%2Fcss-tools-coda-plugin%2F&#038;seed_title=%26%238226%3B+CSS+Tools+Coda+Plugin</link>
		<comments>http://mondaybynoon.com/20081215/css-tools-coda-plugin/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 14:45:12 +0000</pubDate>
		<dc:creator>Jonathan Christopher</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Workbench]]></category>
		<category><![CDATA[Coda]]></category>
		<category><![CDATA[CSSTidy]]></category>
		<category><![CDATA[Panic]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[reformat]]></category>

		<guid isPermaLink="false">http://mondaybynoon.com/?p=261</guid>
		<description><![CDATA[CSS Tools allows you to reformat and compress your style sheets<br /><p><a href='http://rss.buysellads.com/click.php?z=1269068&k=2ee344414ac81fbb0f9de6ab08e9831e&a=261&c=1737193870' target='_blank' rel='nofollow'>
				<img src='http://rss.buysellads.com/img.php?z=1269068&k=2ee344414ac81fbb0f9de6ab08e9831e&a=261&c=1737193870' border='0' alt='' /></a></p><p><a href='http://buysellads.com/buy/sitedetails/pubkey/2ee344414ac81fbb0f9de6ab08e9831e/zone/1269068' target='_blank'>Advertise here with BSA</a></p>]]></description>
			<content:encoded><![CDATA[<p class="update"><strong>Update:</strong> CSS Tools is <em>no longer maintained</em> by me and is <a href="https://github.com/jchristopher/CSS-Tools-Coda-Plugin">available on GitHub</a>.</p>
<p>I&#8217;ve been using <a href="http://www.panic.com/coda">Coda</a> on a more consistent basis lately, primarily due to the inclusion of <a href="http://www.panic.com/coda/developer/community/plugins.php">third party plugins</a>. As I work, I&#8217;ll find myself missing a few features from <a href="http://www.macromates.com">TextMate</a> bundles. Since it&#8217;s terribly easy to <a href="http://www.panic.com/coda/developer/howto/plugins.php">write your own Coda plugin</a>, I&#8217;m going to make a consistent effort to write and maintain a small library of plugins over the coming months.</p>
<h2>CSS Tools</h2>
<p>My latest plugin finds its roots in an article I wrote not too long ago; <a href="/2008/09/01/css-organization-methods-and-writing-style/">CSS Organization Methods and Writing Style</a>. 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&#8217;m in the &#8216;single line&#8217; camp, but I absolutely understand why other authors prefer multi line.</p>
<p>I came up with a proposed solution; <a href="/reformat-css/">reformat your CSS</a>. That tool uses <a href="http://csstidy.sourceforge.net/">CSSTidy</a> 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.)</p>
<p>Basically, CSS Tools brings that functionality to Coda. You&#8217;re able to convert a style sheet from single line to multi line and vice versa. You&#8217;re also able to compress your CSS if you&#8217;d like. Take a look:</p>
<div class="video">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="634" height="382" id="viddler_19850581"><param name="movie" value="http://www.viddler.com/player/19850581/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/player/19850581/" width="634" height="382" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler_19850581" ></embed></object></p>
<p><a href="http://www.viddler.com/explore/jchristopher/videos/8/">CSS Tools plugin for Coda</a> on <a href="http://www.viddler.com">Viddler</a></p>
</div>
<p>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.</p>
<h3>Download CSS Tools</h3>
<dl>
<dt><a href="/download/plugins/coda/csstools/csstools_1.0.1.zip">Version 1.0.1</a></dt>
<dd>February 4, 2009 &#8211; Attempt to fix issues with plugin failing to execute commands</dd>
<dt><a href="/download/plugins/coda/csstools/csstools_1.0.zip">Version 1.0</a></dt>
<dd>December 15, 2008 &#8211; Initial release</dd>
</dl>
<br /><p><a href='http://rss.buysellads.com/click.php?z=1269068&k=2ee344414ac81fbb0f9de6ab08e9831e&a=261&c=1505682043' target='_blank' rel='nofollow'>
				<img src='http://rss.buysellads.com/img.php?z=1269068&k=2ee344414ac81fbb0f9de6ab08e9831e&a=261&c=1505682043' border='0' alt='' /></a></p><p><a href='http://buysellads.com/buy/sitedetails/pubkey/2ee344414ac81fbb0f9de6ab08e9831e/zone/1269068' target='_blank'>Advertise here with BSA</a></p>]]></content:encoded>
			<wfw:commentRss>http://mondaybynoon.com/20081215/css-tools-coda-plugin/feed/</wfw:commentRss>
		<slash:comments>98</slash:comments>
		</item>
		<item>
		<title>&#8226; CSS Organization Methods and Writing Style</title>
		<link>http://mondaybynoon.com/feeder/?FeederAction=clicked&#038;feed=Posts+%28RSS2%29&#038;seed=http%3A%2F%2Fmondaybynoon.com%2F20080901%2Fcss-organization-methods-and-writing-style%2F&#038;seed_title=%26%238226%3B+CSS+Organization+Methods+and+Writing+Style</link>
		<comments>http://mondaybynoon.com/20080901/css-organization-methods-and-writing-style/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 15:18:34 +0000</pubDate>
		<dc:creator>Jonathan Christopher</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Improving Process]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Workbench]]></category>
		<category><![CDATA[CSSEdit]]></category>
		<category><![CDATA[CSSTidy]]></category>
		<category><![CDATA[organization]]></category>

		<guid isPermaLink="false">http://mondaybynoon.com/?p=173</guid>
		<description><![CDATA[There are many ways to organize and optimize your CSS. This document discusses some of those methods.<br /><p><a href='http://rss.buysellads.com/click.php?z=1269068&k=2ee344414ac81fbb0f9de6ab08e9831e&a=173&c=917177657' target='_blank' rel='nofollow'>
				<img src='http://rss.buysellads.com/img.php?z=1269068&k=2ee344414ac81fbb0f9de6ab08e9831e&a=173&c=917177657' border='0' alt='' /></a></p><p><a href='http://buysellads.com/buy/sitedetails/pubkey/2ee344414ac81fbb0f9de6ab08e9831e/zone/1269068' target='_blank'>Advertise here with BSA</a></p>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s only natural to have preferences. Personal preferences help define your character, your style. Each day, you apply your personal preferences to nearly everything you do, right down to the way you write your code. Some developers don&#8217;t even know they&#8217;re doing it, while others are outright forceful when it comes to a conversation about whitespace.</p>
<p>I&#8217;d like to cover some common techniques for writing <abbr title="Cascading Style Sheets">CSS</abbr>. This article is in no way meant to indicate that method A is in any way, shape, or form superior to method B. Please keep that in mind as you read. Topics such as this tend to spark quite the debate, but that&#8217;s not my goal. The purpose of this article is to provide insight to other ways of doing things.</p>
<h2>Commenting your CSS</h2>
<p>As with all software development, commenting is applicable and important when it comes to CSS. Also similar to other software development, with CSS there are good methods of commenting, as well as less than ideal methods. Comments can be useful not only as a personal reference, but also invaluable to your teammates or coworkers.</p>
<p>At the top of the list comes headings/grouping. Many developers will segment their CSS into related groups of selectors. This helps a great deal when it comes to maintenance. Having all of your related styles in proximity with one another is greatly beneficial. There are a number of ways to effectively group your styles by section. My preferred method is as follows:</p>
<pre class="sh_css"><code>/* Heading
------------------------------------------------------- */

.selector { property:value; }
.selector #selector { property:value; property:value; }</code></pre>
<p>Creating headings allows me to quickly scan a style sheet and make the change I&#8217;m looking to implement. There are many different methods to effectively format your headings, make sure you&#8217;re using one that&#8217;s easily identifiable, e.g.:</p>
<pre class="sh_css"><code>/* =========== */
/* = Heading = */
/* =========== */

.selector { property:value; }
.selector #selector { property:value; property:value; }

/* =========================================
   HEADING */

.selector { property:value; }
.selector #selector { property:value; property:value; }

/* ============== [ HEADING ] ============== */

.selector { property:value; }
.selector #selector { property:value; property:value; }</code></pre>
<p>There are plenty of ways to segment your code with a few simple headings. My only suggestion is that you implement it in some way, and remain consistent with it.</p>
<p>Another fantastic, quick to implement, handy comment is a <a href="http://v1.garrettdimon.com/archives/css-maintenance-tip-use-a-color-glossary">color glossary</a>. Simply making a quick note at the top of your style sheet can save you quite a bit of time searching for consistent color values.</p>
<p>Leaving yourself (and your teammates) notes via comments, while not very common from what I&#8217;ve seen, could prove to be useful. The issue here, however, comes down to why you&#8217;re leaving the comment in the first place. If your styles have become so convoluted that you&#8217;re leaving an explanatory note, you may want to revisit the cause of the requirement.</p>
<h2>Single Line vs. Multi Line</h2>
<p>As you may have noticed in my samples, I write single line CSS. Single line vs. multi line CSS has been a debate since the beginning, and continues to evoke <a href="http://flickr.com/photos/jonathansnook/2800852816/">heated discussions</a> to this day.</p>
<p>Most of the debate stems from a direct disruption to the overall readability of the style sheet. Many developers see single line CSS as completely unreadable, while others feel the same way about multi line. I think the main reason behind that is because each developer is looking for something different when they read a style sheet. I, being of the single line variation, hunt for selectors first. Once I&#8217;ve found my selector, I&#8217;ll continue to look for my desired property/value combination, and go from there. Multi line developers seem to hate the fact that property/value combinations aren&#8217;t given nearly as much &#8216;weight&#8217; as selectors, greatly reducing readability.</p>
<p>Both camps are right. There are pros and cons to each way of writing CSS, and at the end of the day, like with all things, you need to do what&#8217;s best for you. Just because someone else uses slightly different formatting doesn&#8217;t make them any better or worse.</p>
<h3>Proposed solution</h3>
<p>I write <a href="http://www.flickr.com/photos/jonchristopher/2800966592/">my (single line) CSS</a> in <a href="http://macrabbit.com/cssedit/">CSSEdit</a>. One of the reasons I like to use the application is because it&#8217;s got reformatting built in. If I need to work on a multi line style sheet, CSSEdit will reformat it to my liking with the click of a button. When I&#8217;m done, I can reformat it back to the way I found it and call it a day.</p>
<p>Unfortunately, CSSEdit is a Mac application, and there are quite a few developers who don&#8217;t run OS X. To &#8216;share the wealth&#8217; of this feature in CSSEdit, I took some time to put together a <a href="/reformat-css/">CSS Reformatter</a>. Powered by the sweet <a href="http://csstidy.sourceforge.net/">CSSTidy</a>, the Reformatter lets you paste your CSS, choose a template format, and provides a reformatted style sheet for you to work with.</p>
<p>I haven&#8217;t had a whole lot of time to work with it, but the Reformatter also allows you to implement your own <a href="http://csstidy.sourceforge.net/templates.php">custom CSSTidy templates</a>. If you don&#8217;t like &#8216;my&#8217; multi line or single line templates, feel free to use your own.</p>
<p>Again, it&#8217;s not a matter of one method being superior to the other, just be sure to use what you&#8217;re comfortable with. Establish a standard among your team, and reformat your CSS to that standard before stopping work on it. Everyone = happy.</p>
<h2>Other methods of organization</h2>
<p>One technique that has come up from time to time is that of alphabetizing your CSS. Basically, the idea is to alphabetize both your selectors as well as properties to make finding specific declarations a very speedy process. At first I was a bit taken back by this approach. It seemed like quite a bit of work both in the initial writing as well as maintenance of a style sheet. I suppose, however, if you&#8217;re accustomed to writing CSS this way, you&#8217;d be very quick in locating various items in your style sheet. Unfortunately, I don&#8217;t like this technique simply because it removes all structure from your document. You could say it&#8217;s structured based on the alphabet, but in my opinion segmenting the styles based on their context is a bit more applicable.</p>
<p>In mentioning &#8216;findability,&#8217; I&#8217;d like to also bring up flagging. Many developers will use certain special characters in their comments to allow quick scanning of a style sheet by way of the editors built in find functionality. For example, you can flag certain comments with an equal sign to signify it is of one &#8216;group&#8217; of selectors, your heading for instance:</p>
<pre class="sh_css"><code>/* =Heading
------------------------------------------------------- */

.selector { property:value; }
.selector #selector { property:value; property:value; }</code></pre>
<p>The idea behind such flags is to bring up the editor find dialog, enter &#8216;=&#8217; and simply search your sections one by one. Personally I haven&#8217;t adopted this approach in favor of straightforward heading comments, but I can definitely see value in it. An issue that may come up, however, is standardization of the flags amongst your team. Make sure everyone is using the same flags for the same purpose, else you&#8217;ll be both confused and frustrated when picking up where someone else left off.</p>
<h3>Separating style sheets</h3>
<p>A technique I&#8217;ll see from time to time, is that of separating style sheets into different files based on purpose. That is to say, there will be one style sheet for typography, another for colors, one for layout, and more. The purpose is to abstract certain selectors based on what you&#8217;re looking to do with them, as well as trim the overall length of your document.</p>
<p>Personally, this method has been more cumbersome than useful for me. I find it difficult to force myself to take care of all the type in one style sheet, colors in another, etc. Additionally, when it comes to maintenance, I dislike the fact that I potentially have to open multiple style sheets to make a &#8216;single&#8217; edit.</p>
<h3>Style sheet compression</h3>
<p>The last bit I&#8217;d like to touch on is CSS compression. To be brutally honest, I never compress my CSS before deployment. I think that may be because of the way I write CSS, however. Since I write single line, compression rarely yields anything more than marginal reduction. I&#8217;d rather save myself the extra layer of maintenance in remembering to keep an uncompressed version.</p>
<p>There are times, however, when I think compression can be a very useful thing. It&#8217;s important to keep in mind that Web browsers download style sheets in their entirety. Anything you can do to reduce that latency will improve performance. If your writing style produces quite a bit of whitespace and/or comments, it may be in your best interest to compress your CSS before deployment.</p>
<h3>My style</h3>
<p>As I mentioned, every developer writes their CSS in a unique way (more-or-less). I write my CSS on a <a href="http://www.flickr.com/photos/jonchristopher/2800966592/">single line basis in CSSEdit</a>. I don&#8217;t use CSSEdit for the Preview functionality or anything like that (although it is quite nice), I use it for two reasons. Number one I mentioned earlier; it has built in functionality to reformat CSS on the fly. The other reason I use CSSEdit is because the application allows me to generate a tree structure within my document by way of flagging comments:</p>
<p class="single image"><a href="http://www.flickr.com/photos/jonchristopher/2800966592/"><img src="http://farm4.static.flickr.com/3194/2800966592_0d2cbdf1fa.jpg?v=0" alt="Screenshot of CSSEdit" /></a></p>
<p>The left column in the interface is a folder structure which allows me to interact with the sections of my CSS. I&#8217;ve come to rely quite a bit on this little feature, and it&#8217;s one of the main reasons I don&#8217;t use my regular text editor when working with CSS.</p>
<p>I hope this piece was at least in part interesting to read. I&#8217;m always curious to find out how other developers get things done, so if you don&#8217;t mind, take a minute to leave some feedback based on your preferences. The more you&#8217;re exposed to as far as methodology is concerned, the better equipped you are to evaluate the way you do things.</p>
<br /><p><a href='http://rss.buysellads.com/click.php?z=1269068&k=2ee344414ac81fbb0f9de6ab08e9831e&a=173&c=1273904203' target='_blank' rel='nofollow'>
				<img src='http://rss.buysellads.com/img.php?z=1269068&k=2ee344414ac81fbb0f9de6ab08e9831e&a=173&c=1273904203' border='0' alt='' /></a></p><p><a href='http://buysellads.com/buy/sitedetails/pubkey/2ee344414ac81fbb0f9de6ab08e9831e/zone/1269068' target='_blank'>Advertise here with BSA</a></p>]]></content:encoded>
			<wfw:commentRss>http://mondaybynoon.com/20080901/css-organization-methods-and-writing-style/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Database Caching 1/56 queries in 0.069 seconds using apc
Object Caching 602/671 objects using apc

Served from: www.mondaybynoon.com @ 2012-02-11 08:57:01 -->
