<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0" xml:base="http://sonspring.com">
<channel>
 <title>SonSpring</title>
 <link>http://sonspring.com</link>
 <description />
 <language>en</language>
<feedburner:info uri="sonspring" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://sonspring.com/rss/" /><feedburner:browserFriendly>SonSpring is a small, Christian web design and graphics studio that specializes in creating sites for churches and non-profit organizations. The mission statement and fervent prayer is that the utmost would be done to glorify the Lord Jesus Christ.</feedburner:browserFriendly><item>
 <title>Sass for Designers</title>
 <link>http://sonspring.com/journal/sass-for-designers</link>
 <description>&lt;a href="/topic/css"&gt;CSS&lt;/a&gt;	&lt;p class="notice"&gt;For more on Sass, read &lt;a href="http://thesassway.com/"&gt;The Sass Way&lt;/a&gt; and follow &lt;a href="http://twitter.com/thesassway"&gt;@TheSassWay&lt;/a&gt; on Twitter.&lt;/p&gt;

	&lt;p&gt;&lt;em&gt;Note: Throughout this post, when I say “Sass” I mean “Sass and Compass.”&lt;/em&gt;&lt;/p&gt;

	&lt;p&gt;This is &lt;strong&gt;not&lt;/strong&gt; a post saying…&lt;/p&gt;

	&lt;blockquote&gt;
		&lt;p&gt;&lt;del&gt;“If you’re still building websites without Sass, you’re doing it wrong.”&lt;/del&gt;&lt;/p&gt;
	&lt;/blockquote&gt;

	&lt;p&gt;This &lt;strong&gt;is&lt;/strong&gt; a post saying:&lt;/p&gt;

	&lt;blockquote&gt;
		&lt;p&gt;“If you haven’t tried Sass/Compass, please do before dismissing it.”&lt;/p&gt;
	&lt;/blockquote&gt;

 &lt;hr /&gt;&lt;h2&gt;My Lawn…&lt;/h2&gt;

	&lt;p class="align_right"&gt;&lt;img src="/sites/default/files/clint_eastwood_css.jpg" title="Get Off My Lawn!" alt="Get Off My Lawn!" width="500" height="380" /&gt;&lt;br /&gt;&lt;small class="mute"&gt;Clint Eastwood in &lt;a href="http://en.wikipedia.org/wiki/Gran_Torino"&gt;Gran Torino&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

	&lt;p&gt;If you are anything like me, then as a designer you are also probably a bit of a curmudgeon, though perhaps you consider it perfectionism – and justifiably so. You have honed a specific workflow you adhere to because &lt;em&gt;that is what works, dang it&lt;/em&gt;. Woe unto anyone who suggests you are not doing things in the best possible way, right? Yes, exactly! Except, well… no.&lt;/p&gt;

	&lt;p&gt;I believe my first reaction to &lt;a href="http://wynnnetherland.com/"&gt;Wynn Netherland&lt;/a&gt;, when he told me I ought to try Sass and that perhaps I would see a boost in productivity, was something along the lines of: “Bah, get off my lawn” — a reference to the cantankerous character played by Clint Eastwood in &lt;a href="http://en.wikipedia.org/wiki/Gran_Torino"&gt;Gran Torino&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;I came to realize that his suggestion was not a subtle way of saying “I know something you don’t know” (though he did), but more of a friendly nudge towards greater efficiency. He was just being a good neighbor, so to speak.&lt;/p&gt;

	&lt;p&gt;So, I am writing this post in an attempt to get designers out there (who are also already &lt;span class="caps"&gt;CSS&lt;/span&gt; savvy) to try &lt;a href="http://sass-lang.com/"&gt;Sass&lt;/a&gt; and &lt;a href="http://compass-style.org/"&gt;Compass&lt;/a&gt;. I aim for this to be the article I wish I had read when I was first contemplating Sass but (at the time) did not consider it worthwhile. I could not have been more wrong.&lt;/p&gt;

	&lt;h3&gt;&lt;abbr title="Fear, Uncertainty, and Doubt"&gt;&lt;span class="caps"&gt;FUD&lt;/span&gt;&lt;/abbr&gt;&lt;/h3&gt;

	&lt;p&gt;There seem to be a number of false assumptions that designers get hung up on when it comes to the topic of &lt;span class="caps"&gt;CSS&lt;/span&gt; preprocessors. I know such misconceptions exist because I myself had these doubts ruminating in the back of my mind, and have seen others express similar sentiment, without actually having tried Sass. I hope to clear some of those up here…&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Myth:&lt;/strong&gt;&lt;/p&gt;

	&lt;ol&gt;&lt;li&gt;Using the command-line is hard&lt;/li&gt;
		&lt;li&gt;Using the command-line is inconvenient&lt;/li&gt;
		&lt;li&gt;I must learn both &lt;a href="http://sass-lang.com/"&gt;Sass&lt;/a&gt; &lt;em&gt;and&lt;/em&gt; &lt;a href="http://compass-style.org/"&gt;Compass&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;Sass requires me to know Ruby&lt;/li&gt;
		&lt;li&gt;Sass requires a foreign syntax&lt;/li&gt;
		&lt;li&gt;Sass only works in Ruby on Rails&lt;/li&gt;
		&lt;li&gt;Sass is always white-space sensitive&lt;/li&gt;
	&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;Fact:&lt;/strong&gt;&lt;/p&gt;

	&lt;ol&gt;&lt;li&gt;Using the command-line is not scary&lt;/li&gt;
		&lt;li&gt;Using the command-line is infrequent&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://sass-lang.com/"&gt;Sass&lt;/a&gt; and &lt;a href="http://compass-style.org/"&gt;Compass&lt;/a&gt; go hand-in-hand&lt;/li&gt;
		&lt;li&gt;Sass doesn’t require Ruby knowledge&lt;/li&gt;
		&lt;li&gt;Sass is just &lt;span class="caps"&gt;CSS&lt;/span&gt; syntax, with extras&lt;/li&gt;
		&lt;li&gt;Sass runs on Ruby (already on OS X)&lt;br /&gt;
— outputs flat &lt;span class="caps"&gt;CSS&lt;/span&gt;, to use anywhere&lt;/li&gt;
		&lt;li&gt;Sass itself is white-space sensitive&lt;br /&gt;
— &lt;span class="caps"&gt;SCSS&lt;/span&gt; is not, use either one&lt;/li&gt;
	&lt;/ol&gt;&lt;p&gt;Think of it this way… As a designer you have undoubtedly worked on &lt;em&gt;some&lt;/em&gt; project using &lt;span class="caps"&gt;PHP&lt;/span&gt;, Django, Rails, etc. You &lt;em&gt;do&lt;/em&gt; realize &lt;span class="caps"&gt;PHP&lt;/span&gt; is a recursive acronym that means &lt;a href="http://en.wikipedia.org/wiki/PHP"&gt;&lt;span class="caps"&gt;PHP&lt;/span&gt;: Hypertext Preprocessor&lt;/a&gt; — don’t you? Somehow, it is perfectly fine to preprocess &lt;span class="caps"&gt;HTML&lt;/span&gt; for productivity gains. Why should &lt;span class="caps"&gt;CSS&lt;/span&gt; be off the table?&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;Setup&lt;/h2&gt;

	&lt;p&gt;&lt;strong&gt;Windows:&lt;/strong&gt;&lt;/p&gt;

	&lt;p&gt;On Windows, you will first need to run the &lt;a href="http://rubyinstaller.org/"&gt;Ruby Installer&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Linux:&lt;/strong&gt;&lt;/p&gt;

	&lt;p&gt;On Linux, &lt;a href="https://github.com/joshfng/railsready"&gt;Rails Ready&lt;/a&gt; provides several Ruby essentials – read more &lt;a href="http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/"&gt;here&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;OS X:&lt;/strong&gt;&lt;/p&gt;

	&lt;p&gt;This “just works” on a Mac, because Ruby is installed by default on OS X.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;Gem Install&lt;/h2&gt;

	&lt;p class="notice"&gt;Note: The &lt;strong&gt;~&lt;/strong&gt; symbol is an alias to &lt;em&gt;username&lt;/em&gt; on OS X and Linux. If using Windows, replace &lt;strong&gt;~&lt;/strong&gt; with &lt;code&gt;%USERPROFILE%&lt;/code&gt; in the following command-line examples.&lt;/p&gt;

	&lt;p&gt;For the sake of brevity, and server language agnosticism, let’s say you want to use Sass on a flat-file &lt;span class="caps"&gt;HTML&lt;/span&gt; site. To install Compass, which comes with Sass, just open up your favorite command-line utility, such as Terminal.app and type…&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Windows:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;gem install compass
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;Linux + OS X:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo gem install compass
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Next… Actually, that’s it! Compass and Sass are now installed.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;New Project&lt;/h2&gt;

	&lt;p&gt;Still got Terminal open? Good, just a few more minor things to type.&lt;/p&gt;

	&lt;p&gt;To create a &lt;strong&gt;&lt;span class="caps"&gt;SCSS&lt;/span&gt;&lt;/strong&gt; project named “my_project” on your desktop, do this…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;compass create ~/desktop/my_project
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Or, to create a &lt;strong&gt;Sass&lt;/strong&gt; project named “my_project” on your desktop, type…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;compass create ~/desktop/my_project -x sass
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Regardless if you specified Sass (or defaulted to &lt;span class="caps"&gt;SCSS&lt;/span&gt;) as your preferred syntax, you will see a directory named “my_project” on your desktop, with a &lt;em&gt;config.rb&lt;/em&gt; file inside. Really, this is all you need to get a Compass project going. You will see the various options nicely explained in the “#” comments.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;config.rb&lt;/strong&gt; file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# Require any additional compass plugins here.
&lt;/code&gt;
&lt;code&gt;# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
&lt;/code&gt;
&lt;code&gt;# You can select your preferred output style
# here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
&lt;/code&gt;
&lt;code&gt;# To enable relative paths to assets via
# compass helper functions. Uncomment:
# relative_assets = true
&lt;/code&gt;
&lt;code&gt;# To disable debugging comments that display the
# original location of your selectors. Uncomment:
# line_comments = false
&lt;/code&gt;
&lt;code&gt;preferred_syntax = :sass
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Now that you’re done creating the project, you won’t need to type “compass create” again until you want to create an entirely new project. Or, if you’re like me – you can tweak your newly created project files and save them to reuse later as starting point for new projects. After which, all you’ll have to do is…&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;Compass Watch&lt;/h2&gt;

	&lt;p&gt;Now that the “my_project” directory exists, go into it…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd ~/desktop/my_project
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Then tell Compass to watch for changes to your *.sass (or *.scss) files…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;compass watch
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;As changes are detected in your *.sass (or *.scss), new *.css file(s) will be compiled on-the-fly. Once you’re satisfied with how things have shaped up, you can hit Ctrl-C to stop the watcher, and go deploy your flat &lt;span class="caps"&gt;CSS&lt;/span&gt;.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;Syntax&lt;/h2&gt;

	&lt;p&gt;You can use either the Sass or &lt;span class="caps"&gt;SCSS&lt;/span&gt; syntax, and can even have *.sass files and *.scss files in the same project, as long as you don’t mix the syntax within the same file. You can also &lt;code&gt;@import&lt;/code&gt; flat *.css files into a *.sass or *.scss file. It all compiles down nicely into flat *.css file(s).&lt;/p&gt;

	&lt;p&gt;Sass and &lt;span class="caps"&gt;SCSS&lt;/span&gt; differ only in that &lt;span class="caps"&gt;SCSS&lt;/span&gt; syntax is a “super-set” of CSS3 — just a fancy term that means all regular &lt;span class="caps"&gt;CSS&lt;/span&gt; still works fine inside of &lt;span class="caps"&gt;SCSS&lt;/span&gt; — and curly braces and semi-colons are still valid and required.&lt;/p&gt;

	&lt;p&gt;Whereas in a Sass file, curly braces and semi-colons are not only unnecessary, they’re invalid. That might sound like crazy talk at first glance, but after having tried both, I can say I greatly prefer Sass to &lt;span class="caps"&gt;SCSS&lt;/span&gt;. But to each his/her own.&lt;/p&gt;

	&lt;p&gt;At it’s core, Sass syntax can be thought of as simply &lt;span class="caps"&gt;CSS&lt;/span&gt; without &lt;code&gt;{&lt;/code&gt;, &lt;code&gt;}&lt;/code&gt;, or &lt;code&gt;;&lt;/code&gt;. In fact, if you do a find-and-replace, substituting nothingness for those characters “”, you’ll be all set to start converting flat &lt;span class="caps"&gt;CSS&lt;/span&gt; files into Sass.&lt;/p&gt;

	&lt;p&gt;By way of example, here is the same code in &lt;span class="caps"&gt;SCSS&lt;/span&gt; and Sass, and what it would look like compiled (or written long-hand) in &lt;span class="caps"&gt;CSS&lt;/span&gt;…&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;SCSS&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// This comment is not output to CSS.
&lt;/code&gt;
&lt;code&gt;/* This comment is output to CSS */
&lt;/code&gt;
&lt;code&gt;#foo {
  font: {
    size: 13px;
    family: 'Helvetica Neue', Arial, sans-serif;
  }
  .bar,
  .baz {
    border-width: 1px;
  }
  .bar {
    border: {
      style: solid;
      color: #369;
    }
  }
  .baz {
     border: {
      style: dotted;
      color: #693;
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;Sass:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// This comment is not output to CSS.
&lt;/code&gt;
&lt;code&gt;/* This comment is output to CSS */
&lt;/code&gt;
&lt;code&gt;#foo
  font:
    size: 13px
    family: 'Helvetica Neue', Arial, sans-serif
&lt;/code&gt;
&lt;code&gt;  .bar,
  .baz
    border-width: 1px
&lt;/code&gt;
&lt;code&gt;  .bar
    border:
      style: solid
      color: #369
&lt;/code&gt;
&lt;code&gt;  .baz
    border:
      style: dotted
      color: #693
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;CSS&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/* This comment is output to CSS */
&lt;/code&gt;
&lt;code&gt;/* line 5, ../sass/screen.sass */
#foo {
  font-size: 13px;
  font-family: "Helvetica Neue", Arial, sans-serif;
}
&lt;/code&gt;
&lt;code&gt;/* line 10, ../sass/screen.sass */
#foo .bar,
#foo .baz {
  border-width: 1px;
}
&lt;/code&gt;
&lt;code&gt;/* line 14, ../sass/screen.sass */
#foo .bar {
  border-style: solid;
  border-color: #336699;
}
&lt;/code&gt;
&lt;code&gt;/* line 19, ../sass/screen.sass */
#foo .baz {
  border-style: dotted;
  border-color: #669933;
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Compression&lt;/h3&gt;

	&lt;p&gt;You’ll note in the example above that the line numbers for each selector are written out in the &lt;span class="caps"&gt;CSS&lt;/span&gt; file, via comments. This is helpful if you combining multiple files via Sass importing, because unlike the typical &lt;code&gt;@import&lt;/code&gt; in a flat &lt;span class="caps"&gt;CSS&lt;/span&gt; file, Sass will combine multiple files into one. This style of commenting helps you trace the origin of a style, in case you wanted to debug.&lt;/p&gt;

	&lt;p&gt;When deploying to production once everything is solid, there is little need for these comments (nor indentation and line breaks), because browsers will render the code with or without them. Thankfully, all it takes is setting one option in your config.rb file, and everything will be minified auto-magically…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;output_style = :compressed
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This yields code that is difficult to read for humans, but is perfectly optimized to save precious bytes, and is perfectly parsable by any given browser…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#foo{font-size:13px;font-family:"Helvetica Neue",Arial,sans-serif}#foo .bar,#foo .baz{border-width:1px}#foo .bar{border-style:solid;border-color:#369}#foo .baz{border-style:dotted;border-color:#693}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You’ll even notice that every instance of “;}” has been replaced with “}” because &lt;span class="caps"&gt;CSS&lt;/span&gt; does not require a semi-colon on the last rule of each block. Little things like this add up, potentially resulting in a significant reduction of overall file-size. This equates to faster page loading, which we all know is &lt;a href="http://code.google.com/speed/"&gt;pretty important&lt;/a&gt;.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;Compass&lt;/h2&gt;

	&lt;p&gt;Even if the aforementioned features were &lt;em&gt;all&lt;/em&gt; Sass was capable of, it would be worth looking into. At the risk of sounding like an infomercial salesman… But wait, there’s more! Where Sass left off, Compass goes to the next level.&lt;/p&gt;

	&lt;p class="align_right"&gt;&lt;img src="/sites/default/files/css_sass_compass.jpg" title="Captain America = CSS - Sass - Compass" alt="Captain America = CSS - Sass - Compass" width="500" height="360" /&gt;&lt;br /&gt;&lt;small class="mute"&gt;Chris Evans as &lt;a href="http://en.wikipedia.org/wiki/Captain_America:_The_First_Avenger"&gt;Captain America&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

	&lt;h3&gt;Gradients&lt;/h3&gt;

	&lt;p&gt;How many times have you attempted to remember the puzzling syntax for a CSS3 gradient? Though similar in implementation, the code to produce it is maddeningly different depending on the browser.&lt;/p&gt;

	&lt;p&gt;This is where Compass truly shines, providing mixins that output this code for you. With Sass, most of it you write yourself, but Compass is great at bleeding edge CSS3, for which no human should have to remember the syntax.&lt;/p&gt;

	&lt;p&gt;This terse, logical Sass/Compass code:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@import compass/css3
&lt;/code&gt;
&lt;code&gt;#foo
  +background(linear-gradient(#fff, #ccc))
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Turns into this ridiculous assortment:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/* line 3, ../sass/screen.sass */
#foo {
  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #cccccc));
  background: -webkit-linear-gradient(#ffffff, #cccccc);
  background: -moz-linear-gradient(#ffffff, #cccccc);
  background: -o-linear-gradient(#ffffff, #cccccc);
  background: -ms-linear-gradient(#ffffff, #cccccc);
  background: linear-gradient(#ffffff, #cccccc);
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;h4&gt;Experimental &lt;span class="caps"&gt;SVG&lt;/span&gt;&lt;/h4&gt;

	&lt;p&gt;You can even set an “experimental” flag, to have Compass output &lt;span class="caps"&gt;SVG&lt;/span&gt; for you. This is great for browsers like IE9 and older versions of Opera, that understand how to render an embedded base64 encoded image, but can’t natively draw CSS3 gradients. A simple variable set to “true” outputs the necessary code.&lt;/p&gt;

	&lt;p&gt;If you set &lt;code&gt;$experimental-support-for-svg: true&lt;/code&gt;…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@import compass/css3
&lt;/code&gt;
&lt;code&gt;$experimental-support-for-svg: true
&lt;/code&gt;
&lt;code&gt;#foo
  +background(linear-gradient(#fff, #ccc))
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;A base64 encoded &lt;span class="caps"&gt;SVG&lt;/span&gt; string is output…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/* line 5, ../sass/screen.sass */
#foo {
  background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2NjY2NjYyIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #cccccc));
  background: -webkit-linear-gradient(#ffffff, #cccccc);
  background: -moz-linear-gradient(#ffffff, #cccccc);
  background: -o-linear-gradient(#ffffff, #cccccc);
  background: -ms-linear-gradient(#ffffff, #cccccc);
  background: linear-gradient(#ffffff, #cccccc);
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This can potentially add file-size and as such is (smartly) an opt-in feature, because the &lt;code&gt;$experimental-support-for-svg&lt;/code&gt; flag defaults to &lt;code&gt;false&lt;/code&gt; unless you specifically enable it. Still, it’s pretty cool to know it’s there.&lt;/p&gt;

	&lt;h3&gt;Border Radius&lt;/h3&gt;

	&lt;p&gt;Without belaboring the point of how cool Compass is, let me show one more CSS3 example. Adding a border radius is trivial enough, since the syntax is somewhat similar (aside from vendor prefixes), but what if you only wanted to round three out of the four corners of an element? It gets a bit more tricky, because browsers differ: “…top-right-radius” vs. “…radius-topright” etc. Compass to the rescue!&lt;/p&gt;

	&lt;p&gt;You just type this…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@import compass/css3
&lt;/code&gt;
&lt;code&gt;#foo
  +border-top-left-radius(4px)
  +border-top-right-radius(4px)
  +border-bottom-left-radius(4px)
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Compass does the heavy lifting…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/* line 3, ../sass/screen.sass */
#foo {
  -moz-border-radius-topleft: 4px;
  -webkit-border-top-left-radius: 4px;
  -o-border-top-left-radius: 4px;
  -ms-border-top-left-radius: 4px;
  -khtml-border-top-left-radius: 4px;
  border-top-left-radius: 4px;
  -moz-border-radius-topright: 4px;
  -webkit-border-top-right-radius: 4px;
  -o-border-top-right-radius: 4px;
  -ms-border-top-right-radius: 4px;
  -khtml-border-top-right-radius: 4px;
  border-top-right-radius: 4px;
  -moz-border-radius-bottomleft: 4px;
  -webkit-border-bottom-left-radius: 4px;
  -o-border-bottom-left-radius: 4px;
  -ms-border-bottom-left-radius: 4px;
  -khtml-border-bottom-left-radius: 4px;
  border-bottom-left-radius: 4px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;&lt;h2&gt;The Hard Sell&lt;/h2&gt;

	&lt;p&gt;What’s that, champ? You have all that fancy CSS3 syntax memorized already? Right… I bet you do. Keep telling yourself that. Seriously though, even if you know all those keystrokes, who in their right mind wants to type all that?&lt;/p&gt;

	&lt;p&gt;Okay, fine. I will up the ante. Compass also has support for &lt;a href="http://compass-style.org/reference/compass/utilities/sprites/sprite_img/"&gt;image sprites&lt;/a&gt;. You know that &lt;span class="caps"&gt;PSD&lt;/span&gt; or &lt;span class="caps"&gt;PNG&lt;/span&gt; file you maintain with tons of little icons, where you cleverly count the number of pixels each is offset from the top-left of the document? You can quit doing that, and instead have multiple, separate files that Compass will combine into one single &lt;span class="caps"&gt;HTTP&lt;/span&gt; request.&lt;/p&gt;

	&lt;p&gt;Sass also has a slew of &lt;a href="http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html"&gt;color functions&lt;/a&gt; that can act upon colors, so that you don’t have to painstakingly recolor things in Photoshop, and retrieve hex values via the color dropper. If you want to darken something 10%, just do it…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#foo
  color: darken(#369, 10%)
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Which yields…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/* line 1, ../sass/screen.sass */
#foo {
  color: #264c73;
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Oh, and get this… Sass supports math, and Compass adds &lt;a href="http://compass-style.org/examples/compass/helpers/enumerate/"&gt;enumeration&lt;/a&gt;. That means you can create loops that spit out numerically incremented code, perfect for making custom vertical grid dimensions. For example, the &lt;a href="https://github.com/nextmat/compass-960-plugin/blob/master/stylesheets/960/_grid.sass"&gt;960 plugin&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;There is even a plugin to establish a baseline horizontal grid, called &lt;a href="http://compass-style.org/reference/compass/typography/vertical_rhythm/"&gt;vertical rhythm&lt;/a&gt;, allowing you to achieve the (oft sought, rarely realized) goal of uniform line-height throughout an entire page. It’s not automatic, but it certainly gets you further than you might get manually adjusting margin and padding.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;Apps&lt;/h2&gt;

	&lt;p&gt;Currently, there are two apps that can be used to basically simulate “compass watch” to check for changes to *.sass and/or *.scss files and convert them to &lt;span class="caps"&gt;CSS&lt;/span&gt;. Also, I know of at least one other app that’s in progress, currently undergoing a private beta test. The two apps available today are:&lt;/p&gt;

	&lt;ul&gt;&lt;li&gt;&lt;a href="http://compass.handlino.com/"&gt;&lt;strong&gt;Compass.app&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;
— built in: JRuby&lt;br /&gt;
— open source, on &lt;a href="https://github.com/handlino/CompassApp"&gt;GitHub&lt;/a&gt;&lt;br /&gt;
— cost: $7.00 compiled&lt;br /&gt;
 &lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mhs.github.com/scout-app/"&gt;&lt;strong&gt;Scout&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;
— built in: &lt;a href="http://jruby.org/"&gt;JRuby&lt;/a&gt; + &lt;a href="http://www.adobe.com/products/air/"&gt;Adobe &lt;span class="caps"&gt;AIR&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
— open source, on &lt;a href="https://github.com/mhs/scout-app"&gt;GitHub&lt;/a&gt;&lt;br /&gt;
— cost: free&lt;/li&gt;
	&lt;/ul&gt;&lt;hr /&gt;&lt;h2&gt;Done&lt;/h2&gt;

	&lt;p&gt;I could go on and on, but instead I will let you go read more about &lt;a href="http://sass-lang.com/"&gt;Sass&lt;/a&gt; and &lt;a href="http://compass-style.org/"&gt;Compass&lt;/a&gt; in detail. I will say this: If you are a designer who prides yourself on writing efficient front-end code, then I would encourage you to give ‘em a shot. Worst case scenario, you end up back writing &lt;span class="caps"&gt;CSS&lt;/span&gt; the way you have been doing it. Best case scenario, you have another skill to add to the ol’ arsenal.&lt;/p&gt;

	&lt;p&gt;Just think of Sass (and Compass) like the “jQuery of &lt;span class="caps"&gt;CSS&lt;/span&gt;.” Those who understand the fundamentals of &lt;span class="caps"&gt;CSS&lt;/span&gt; will always have an edge over designers who don’t code at all. A solid tool like Compass in the hands of a master &lt;span class="caps"&gt;CSS&lt;/span&gt; craftsman only serves to make him/her all the more effective, further widening the gap.&lt;/p&gt;</description>
 <pubDate>Sun, 28 Aug 2011 18:48:29 +0000</pubDate>
 <dc:creator>Nathan Smith</dc:creator>
 <guid isPermaLink="false">342 at http://sonspring.com</guid>
</item>
<item>
 <title>JavaScript Interview Questions</title>
 <link>http://sonspring.com/journal/javascript-interview-questions</link>
 <description>&lt;a href="/topic/javascript"&gt;JavaScript&lt;/a&gt;	&lt;p&gt;I was perusing my list o’ &lt;span class="caps"&gt;RSS&lt;/span&gt; feeds this evening — Yes, I’m one of those people who still read &lt;span class="caps"&gt;RSS&lt;/span&gt; — and happened upon a list of JavaScript interview questions posted by &lt;a href="http://james.padolsey.com/javascript/javascript-interview-questions/"&gt;James Padolsey&lt;/a&gt;. This reminded me that I had a few questions tucked away from when I was contacted by a &lt;a href="http://meebo.com/"&gt;Meebo&lt;/a&gt; recruiter a few years ago.&lt;/p&gt;

	&lt;p&gt;I didn’t apply for the job, because I was working at the (now defunct) startup &lt;a href="http://viewzi.com/"&gt;Viewzi&lt;/a&gt;, and I didn’t want to uproot from Dallas and move to California. Just for kicks, I asked the recruiter if it’d be okay if I went ahead and tried my hand at their code questions anyway. After which, the recruiter replied:&lt;/p&gt;

	&lt;blockquote&gt;
		&lt;p&gt;You aced the puzzlers, well done! Are you sure you don’t want to be considered for our JavaScript / Front-End Developer position? If you ever have the itch to move to CA, be sure to let me know!&lt;/p&gt;
	&lt;/blockquote&gt;

	&lt;p&gt;Since a few years have elapsed since then, I am hoping that it is kosher for me to share these questions, along with the answers I provided…&lt;/p&gt;

 &lt;hr /&gt;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt;  When does &lt;code&gt;div.setAttribute('###')&lt;/code&gt; not equal &lt;code&gt;div.###&lt;/code&gt;?&lt;/p&gt;

	&lt;p&gt;&lt;em&gt;Answer:&lt;/em&gt;&lt;/p&gt;

	&lt;p&gt;When you’re trying to set an element’s &lt;code&gt;class&lt;/code&gt; attribute, IE has issues. Therefore, it’s better to use &lt;code&gt;.className&lt;/code&gt; instead of &lt;code&gt;.setAttribute()&lt;/code&gt;. There is also an issue with &lt;code&gt;.setAttribute()&lt;/code&gt; and &lt;code&gt;style&lt;/code&gt; in IE, so &lt;code&gt;.style&lt;/code&gt; should be used.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// Don't do this:
el.setAttribute('class', 'foobar');
&lt;/code&gt;
&lt;code&gt;// Do this instead:
el.className = 'foobar';
&lt;/code&gt;
&lt;code&gt;// Don't do this:
el.setAttribute('style', 'color: #000');
&lt;/code&gt;
&lt;code&gt;// Do this instead:
el.style.color = '#000';
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt;  What’s the difference between these two statements:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var x = 3;
&lt;/code&gt;
&lt;code&gt;x = 3;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;em&gt;Answer:&lt;/em&gt;&lt;/p&gt;

	&lt;p&gt;The first puts the variable in the scope of whatever function it was defined. The second places the variable in global scope. It can potentially cause collision with other variables with the same name. Therefore, the keyword &lt;code&gt;var&lt;/code&gt; should always be used when defining variables, and an anonymous function should be used as a closure if need be, encapsulating multiple functions which can share access to the same set of variables. That makes sure the variables stay sandboxed, accessible only by those functions which need them.&lt;/p&gt;

 &lt;hr /&gt;&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt;  What’s the difference between:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;!!(obj1 &amp;amp;&amp;amp; obj2);
&lt;/code&gt;
&lt;code&gt;(obj1 &amp;amp;&amp;amp; obj2);
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;em&gt;Answer:&lt;/em&gt;&lt;/p&gt;

	&lt;p&gt;The first returns a “real” boolean value, because you first negate what is inside the parenthesis, but then immediately negate it again. So, it’s like saying something is “not not” truth-y, making it &lt;code&gt;true&lt;/code&gt;. The second example simply checks for the existence of the &lt;code&gt;obj1&lt;/code&gt; and &lt;code&gt;obj2&lt;/code&gt;, but might not necessarily return a “real” boolean value, instead returning something that is either truth-y or false-y. This can be problematic, because false-y can be the number 0, or an empty string, etc. Simple existence can be truth-y. A “real” boolean will only be &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

 &lt;hr /&gt;&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt;  Write a one-line piece of JavaScript code that concatenates all strings passed into a function. &lt;em&gt;(Note: Formatting added for readability)&lt;/em&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function concatenate() {
  return String.prototype.concat.apply('', arguments);
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;More on that here…&lt;br /&gt;&lt;a href="http://www.sitepen.com/blog/2008/05/09/string-performance-an-analysis/"&gt;http://sitepen.com/blog/2008/05/09/string-performance-an-analysis&lt;/a&gt;&lt;/p&gt;

 &lt;hr /&gt;&lt;p&gt;&lt;strong&gt;5.&lt;/strong&gt;  What do these two examples have in common?&lt;/p&gt;

	&lt;p&gt;&lt;em&gt;Short Answer:&lt;/em&gt;&lt;/p&gt;

	&lt;p&gt;Both create potential memory leaks, especially in Internet Explorer.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var obj = document.getElementById('adiv');
&lt;/code&gt;
&lt;code&gt;document.getElementById('adiv').ptr = obj;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;em&gt;Long Answer:&lt;/em&gt;&lt;/p&gt;

	&lt;p&gt;This is bad practice, because you first assign a &lt;abbr title="Document Object Model"&gt;&lt;span class="caps"&gt;DOM&lt;/span&gt;&lt;/abbr&gt; element to a variable, but then you assign that same element to a (nonexistent) property of the element itself. This creates a sort of circular logic loop, and will negatively impact performance.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function assignClick() {
  var el = document.createElement('div');
&lt;/code&gt;
&lt;code&gt;  function handleClick() {
    el.innerHTML = 'clicked!';
  }
&lt;/code&gt;
&lt;code&gt;  el.attachEvent('onclick', handleClick);
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;em&gt;Long Answer:&lt;/em&gt;&lt;/p&gt;

	&lt;p&gt;This example will only work in Internet Explorer, because it employs the proprietary &lt;code&gt;.attachEvent()&lt;/code&gt; method. Granted, &lt;code&gt;.innerHTML&lt;/code&gt; &lt;del&gt;is also proprietary&lt;/del&gt; (&lt;a href="http://dev.w3.org/html5/spec/Overview.html#innerhtml"&gt;now a standard&lt;/a&gt;), but unlike &lt;code&gt;.attachEvent()&lt;/code&gt;, &lt;code&gt;.innerHTML&lt;/code&gt; is widely supported in all modern browsers. To make this example more cross-browser friendly, the W3C standard &lt;code&gt;.addEventListener()&lt;/code&gt; should attempted first, and if it does not exist, then try &lt;code&gt;.attachEvent()&lt;/code&gt; as a fallback.&lt;/p&gt;</description>
 <pubDate>Wed, 08 Jun 2011 05:05:34 +0000</pubDate>
 <dc:creator>Nathan Smith</dc:creator>
 <guid isPermaLink="false">341 at http://sonspring.com</guid>
</item>
<item>
 <title>HTML5 in Drupal 7</title>
 <link>http://sonspring.com/journal/html5-in-drupal-7</link>
 <description>&lt;a href="/topic/content-management"&gt;Content Management&lt;/a&gt;	&lt;p&gt;I have been meaning to write this post for awhile. A few friends have &lt;a href="http://twitter.com/inlikealion/status/38684821160992768"&gt;asked&lt;/a&gt; me to &lt;a href="http://twitter.com/inlikealion/status/38685204142886912"&gt;explain&lt;/a&gt; how to do HTML5 in &lt;a href="http://drupal.org/"&gt;Drupal&lt;/a&gt; 7, via &lt;a href="http://twitter.com/mortendk/status/70985509362601984"&gt;Twitter&lt;/a&gt;. Another concerned individual, having found a passing reference to it in a &lt;a href="http://sonspring.com/journal/drupal-7-first-look"&gt;book review&lt;/a&gt;, even emailed:&lt;/p&gt;

	&lt;blockquote&gt;
		&lt;p&gt;“I &lt;strong&gt;urge&lt;/strong&gt; you to start producing this post just as deeply as you explained basic 960 principles. How I enjoyed reading it. It was like a chat with a soulmate! It is a rare opportunity to read &lt;strong&gt;background&lt;/strong&gt; on &lt;strong&gt;why&lt;/strong&gt; things are the way they are. In my mental system, why is the key ingredient to &lt;strong&gt;know what are you doing&lt;/strong&gt;.”&lt;/p&gt;
	&lt;/blockquote&gt;

	&lt;p&gt;So, without further ado, here it is…&lt;/p&gt;

	&lt;ul&gt;&lt;li&gt;&lt;a href="http://sonspring.com/journal/html5-in-drupal-7#_intro"&gt;Intro&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://sonspring.com/journal/html5-in-drupal-7#_structure"&gt;Structure&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://sonspring.com/journal/html5-in-drupal-7#_aggregation"&gt;Aggregation&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://sonspring.com/journal/html5-in-drupal-7#_section"&gt;Template.php – Section&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://sonspring.com/journal/html5-in-drupal-7#_pruning"&gt;Template.php – Pruning&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://sonspring.com/journal/html5-in-drupal-7#_minification"&gt;Template.php – Minification&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://sonspring.com/journal/html5-in-drupal-7#_block_field_region_views"&gt;Block, Field, Region, Views&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://sonspring.com/journal/html5-in-drupal-7#_html_page_node"&gt;&lt;span class="caps"&gt;HTML&lt;/span&gt;, Page, Node&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://sonspring.com/journal/html5-in-drupal-7#_includes"&gt;Includes&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://sonspring.com/journal/html5-in-drupal-7#_conclusion"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;&lt;hr /&gt;&lt;h2 id="_intro"&gt;Intro&lt;/h2&gt;

	&lt;p&gt;In addition to HTML5, I will cover how to remove some of the generated markup Drupal spits out by default, and how to override default system &lt;span class="caps"&gt;CSS&lt;/span&gt;. I will also provide a few tips on how to get some quick-win page speed boosts.&lt;/p&gt;

	&lt;p&gt;Before we dive in, I just wanted to mention that this won’t be a comprehensive &lt;em&gt;how-to&lt;/em&gt; on building a Drupal 7 theme. For the sake of brevity, I won’t be covering the &lt;a href="http://drupal.org/project/html5_tools"&gt;HTML5 Tools&lt;/a&gt; module, which endeavors to add features like new HTML5 form elements to Drupal. Instead, I will focus on trimming the &lt;span class="caps"&gt;XHTML&lt;/span&gt; glut that Drupal still instinctively wants to include, stemming from its earlier days.&lt;/p&gt;

	&lt;p&gt;Remember — back before the W3C declared &lt;a href="http://www.zeldman.com/2009/07/02/xhtml-wtf/"&gt;&lt;span class="caps"&gt;XHTML&lt;/span&gt; 2.0 is dead&lt;/a&gt;, heralding HTML5 as the future — when we all used to put &lt;code&gt;type="text/css"&lt;/code&gt; on tags, as if we’d ever used a &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; tag that &lt;em&gt;wasn’t&lt;/em&gt; &lt;span class="caps"&gt;CSS&lt;/span&gt;? Oh how silly we were! Yet we thought we were so cool, appeasing the &lt;a href="http://validator.w3.org/"&gt;validator&lt;/a&gt;. Then &lt;a href="http://html5.org/"&gt;HTML5&lt;/a&gt; came along, paving cowpaths, exposing the tedium of so many practices we’d once thought necessary.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2 id="_structure"&gt;Structure&lt;/h2&gt;

	&lt;p&gt;When you first install Drupal, you will see a top-level directory named &lt;em&gt;themes&lt;/em&gt;. Common sense would tell you that this is where you should store your own theme related files. In this case, common sense is &lt;em&gt;wrong&lt;/em&gt;! In actuality, the directory you want to play in is &lt;em&gt;sites&lt;/em&gt;. This is all about you and your particular site(s), and therein is another &lt;em&gt;themes&lt;/em&gt; directory that will house your theme(s).&lt;/p&gt;

	&lt;p&gt;Note: Drupal can handle multiple domains via a single codebase, hence the “sites” directory instead of “site,” but that’s beyond the scope of this article. If you’re interested, there’s a &lt;a href="http://groups.drupal.org/multisite"&gt;Multisite&lt;/a&gt; Drupal group dedicated to the topic.&lt;/p&gt;

	&lt;p&gt;&lt;img src="/sites/default/files/drupal_7_theme_structure.png" title="Drupal 7 - Theme Structure" alt="Drupal 7 - Theme Structure" width="500" height="350" /&gt;&lt;/p&gt;

	&lt;p&gt;The first thing you should do is create a &lt;em&gt;*.info&lt;/em&gt; file with the name of your theme. Since my site is sonspring.com, and my theme is aptly named “SonSpring,” my info file is &lt;em&gt;sonspring.info&lt;/em&gt;. Here are the contents (”;” comments out a line)…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;; BASIC SETTINGS
name = SonSpring
core = 7.x
&lt;/code&gt;
&lt;code&gt;; FEATURES (intentionally blank)
features[] =
&lt;/code&gt;
&lt;code&gt;; REGIONS
regions[front_journal] = front_journal
regions[content] = content
regions[sidebar_first] = sidebar_first
regions[sidebar_second] = sidebar_second
regions[search] = search
&lt;/code&gt;
&lt;code&gt;; CSS
stylesheets[all][] = assets/css/override/kill/ctools.css
stylesheets[all][] = assets/css/override/kill/field.css
stylesheets[all][] = assets/css/override/kill/node.css
stylesheets[all][] = assets/css/override/kill/system.messages.css
stylesheets[all][] = assets/css/override/kill/system.menus.css
stylesheets[all][] = assets/css/override/kill/user.css
stylesheets[all][] = assets/css/override/kill/views.css
stylesheets[all][] = assets/css/reset.css
stylesheets[all][] = assets/css/override/keep/system.base.css
stylesheets[all][] = assets/css/override/keep/system.theme.css
stylesheets[all][] = assets/css/override/keep/search.css
stylesheets[all][] = assets/css/960_12_col.css
stylesheets[all][] = assets/css/text.css
stylesheets[all][] = assets/css/formalize.css
stylesheets[all][] = assets/css/site.css
&lt;/code&gt;
&lt;code&gt;; JAVASCRIPT
scripts[] = assets/js/master.min.js
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;&lt;h2 id="_aggregation"&gt;Aggregation&lt;/h2&gt;

	&lt;p&gt;If you’ve looked at any Drupal themes, the preceding code is pretty straightforward stuff, nothing too out of the ordinary. One thing you might have noticed is the &lt;em&gt;override&lt;/em&gt; directory. Inside it are two other directories, &lt;em&gt;kill&lt;/em&gt; and &lt;em&gt;keep&lt;/em&gt;.&lt;/p&gt;

	&lt;p&gt;I learned this trick from &lt;a href="http://morten.dk/"&gt;Morten Birch Heide-jørgensen&lt;/a&gt; during one of his talks on Drupal theming. He calls his folder &lt;em&gt;foad&lt;/em&gt; and the technique &lt;abbr title="F*** Off And Die"&gt;&lt;span class="caps"&gt;FOAD&lt;/span&gt;&lt;/abbr&gt;, short for “F*** Off And Die” – a clever way to get rid of system &lt;span class="caps"&gt;CSS&lt;/span&gt; files you don’t want.&lt;/p&gt;

	&lt;p&gt;If you name one of your own &lt;span class="caps"&gt;CSS&lt;/span&gt; files the same as one of the defaults, Drupal will include yours instead of providing its own. Thusly, everything in the &lt;em&gt;kill&lt;/em&gt; directory is just an empty file, whereas everything in the &lt;em&gt;keep&lt;/em&gt; directory is a &lt;span class="caps"&gt;CSS&lt;/span&gt; file that’s been only slightly (if at all) modified from its original defaults.&lt;/p&gt;

	&lt;p&gt;Now, you might be wondering: Why bother having a &lt;em&gt;keep&lt;/em&gt; directory at all, if I’m reusing the very same code as the default files it contains? Here’s where it gets interesting. When you go to the &lt;em&gt;Performance&lt;/em&gt; admin page, and turn on aggregation and compression of &lt;span class="caps"&gt;CSS&lt;/span&gt; files, Drupal will gather up all its default system stylesheets into a single file, and all your stylesheets into another.&lt;/p&gt;

	&lt;p&gt;That’s silly. But with my &lt;em&gt;keep&lt;/em&gt; directory, I force those default stylesheets – along with my theme stylesheets – to be aggregated and compressed into one file.&lt;/p&gt;

	&lt;p&gt;&lt;img src="/sites/default/files/drupal_7_performance.png" title="Drupal 7 - Performance" alt="Drupal 7 - Performance" width="500" height="176" /&gt;&lt;/p&gt;

 &lt;hr /&gt;&lt;h2 id="_section"&gt;Template.php – Section&lt;/h2&gt;

	&lt;p&gt;Call it an old habit from my beginner &lt;abbr title="Content Management System"&gt;&lt;span class="caps"&gt;CMS&lt;/span&gt;&lt;/abbr&gt; days using &lt;a href="http://textpattern.com/"&gt;Textpattern&lt;/a&gt;, but for theming purposes I like to know what “section” of the site I’m on. Basically, that just means I am curious what &lt;strong&gt;foobar&lt;/strong&gt; is equal to, in the following scenarios…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;http://example.com/foobar
&lt;/code&gt;
&lt;code&gt;http://example.com/foobar?page=1
&lt;/code&gt;
&lt;code&gt;http://example.com/foobar/node/search%20term
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;So, at the beginning of my &lt;em&gt;template.php&lt;/em&gt; file, I have a simple function that runs through and grabs me the first path fragment in the &lt;span class="caps"&gt;URL&lt;/span&gt;, does a simple switch/case, and returns a string that becomes the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; ID.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php
&lt;/code&gt;
&lt;code&gt;function sonspring_section() {
  $section_path = explode('/', request_uri());
  $section_name = $section_path[1];
  $section_q = strpos($section_name, '?');
&lt;/code&gt;
&lt;code&gt;  if ($section_q) {
    $section_name = substr($section_name, 0, $section_q);
  }
&lt;/code&gt;
&lt;code&gt;  switch ($section_name) {
    case '':
      return 'section_home';
      break;
    case 'journal':
      return 'section_journal';
      break;
    case 'about':
      return 'section_about';
      break;
    case 'work':
      return 'section_work';
      break;
    case 'resources':
      return 'section_resources';
      break;
    case 'contact':
      return 'section_contact';
      break;
    case 'search':
      return 'section_search';
      break;
    case 'user':
      return 'section_user';
      break;
    case 'users':
      return 'section_user';
      break;
    case 'filter':
      return 'section_filter';
      break;
    case 'admin':
      return 'section_admin';
      break;
    default:
      return 'section_404';
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;&lt;h2 id="_pruning"&gt;Template.php – Pruning&lt;/h2&gt;

	&lt;p&gt;In my &lt;em&gt;template.php&lt;/em&gt; file, I have a function called &lt;em&gt;sonspring_process_html_tag&lt;/em&gt;. Obviously, if your theme is named “MyTheme” then your function would be named &lt;em&gt;mytheme_process_html_tag&lt;/em&gt;. It simply unsets the variables for the &lt;code&gt;type&lt;/code&gt; and &lt;code&gt;media&lt;/code&gt; attributes on &lt;code&gt;style&lt;/code&gt;, &lt;code&gt;link&lt;/code&gt;, and &lt;code&gt;script&lt;/code&gt; tags.&lt;/p&gt;

	&lt;p&gt;It also clears out &lt;code&gt;CDATA&lt;/code&gt; comments, that only ever existed to satisfy the &lt;span class="caps"&gt;XHTML&lt;/span&gt; validator, because hardly anyone ever served &lt;span class="caps"&gt;XHTML&lt;/span&gt; as &lt;code&gt;application/xhtml+xml&lt;/code&gt;. In the past, even though we all served &lt;span class="caps"&gt;XHTML&lt;/span&gt; as &lt;code&gt;text/html&lt;/code&gt;, we still jumped through hoops by adding &lt;code&gt;CDATA&lt;/code&gt; comments. Not so with HTML5.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// Purge needless XHTML stuff.
function sonspring_process_html_tag(&amp;amp;$vars) {
  $el = &amp;amp;$vars['element'];
&lt;/code&gt;
&lt;code&gt;  // Remove type="..." and CDATA prefix/suffix.
  unset($el['#attributes']['type'], $el['#value_prefix'], $el['#value_suffix']);
&lt;/code&gt;
&lt;code&gt;  // Remove media="all" but leave others unaffected.
  if (isset($el['#attributes']['media']) &amp;amp;&amp;amp; $el['#attributes']['media'] === 'all') {
    unset($el['#attributes']['media']);
  }
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;In reality, &lt;span class="caps"&gt;XHTML&lt;/span&gt; always worked fine without the needless code. HTML5 just makes it official. By way of comparison, here’s the before and after of what Drupal would normally output by default, followed by the slimmed down result.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Before – &lt;span class="caps"&gt;XHTML&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;link rel="stylesheet" href="..." type="text/css" media="all" /&amp;gt;
&lt;/code&gt;
&lt;code&gt;&amp;lt;style type="text/css" media="all"&amp;gt;
/* Code here. */
&amp;lt;/style&amp;gt;
&lt;/code&gt;
&lt;code&gt;&amp;lt;script type="text/javascript"&amp;gt;
&amp;lt;!--//--&amp;gt;&amp;lt;![CDATA[//&amp;gt;&amp;lt;!--
/* Code here. */
//--&amp;gt;&amp;lt;!]]&amp;gt;
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;After – HTML5&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;link rel="stylesheet" href="..." /&amp;gt;
&lt;/code&gt;
&lt;code&gt;&amp;lt;style&amp;gt;
/* Code here. */
&amp;lt;/style&amp;gt;
&lt;/code&gt;
&lt;code&gt;&amp;lt;script&amp;gt;
/* Code here. */
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;&lt;h2 id="_minification"&gt;Template.php – Minification&lt;/h2&gt;

	&lt;p&gt;Though this doesn’t pertain to HTML5 directly, I decided that while I was mucking about in the &lt;em&gt;template.php&lt;/em&gt; file, I might as well add some &lt;span class="caps"&gt;HTML&lt;/span&gt; minification. Basically, the following code just strips out unnecessary whitespace and line breaks, saving a bit of file size where possible. If a page contains a &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt; tag, it is left alone, as to not affect code blocks or text typed in a form.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// Minify HTML output.
function sonspring_process_html(&amp;amp;$vars) {
  $before = array(
    "/&amp;gt;\s\s+/",
    "/\s\s+&amp;lt;/",
    "/&amp;gt;\t+&amp;lt;/",
    "/\s\s+(?=\w)/",
    "/(?&amp;lt;=\w)\s\s+/"
  );
&lt;/code&gt;
&lt;code&gt;  $after = array('&amp;gt; ', ' &amp;lt;', '&amp;gt; &amp;lt;', ' ', ' ');
&lt;/code&gt;
&lt;code&gt;  // Page top.
  $page_top = $vars['page_top'];
  $page_top = preg_replace($before, $after, $page_top);
  $vars['page_top'] = $page_top;
&lt;/code&gt;
&lt;code&gt;  // Page content.
  if (!preg_match('/&amp;lt;pre|&amp;lt;textarea/', $vars['page'])) {
    $page = $vars['page'];
    $page = preg_replace($before, $after, $page);
    $vars['page'] = $page;
  }
&lt;/code&gt;
&lt;code&gt;  // Page bottom.
  $page_bottom = $vars['page_bottom'];
  $page_bottom = preg_replace($before, $after, $page_bottom);
  $vars['page_bottom'] = $page_bottom . drupal_get_js('footer');
}
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;&lt;h2 id="_block_field_region_views"&gt;Block, Field, Region, Views&lt;/h2&gt;

	&lt;p&gt;While it is technically possible to make use of &lt;a href="http://dev.w3.org/html5/rdfa/"&gt;HTML5 and &lt;span class="caps"&gt;RDF&lt;/span&gt;&lt;/a&gt; together, I have opted to simply leave this aspect out of my templates, as you will see shortly. As such, I have simply disabled the &lt;span class="caps"&gt;RDF&lt;/span&gt; module (enabled by default).&lt;/p&gt;

	&lt;p&gt;&lt;img src="/sites/default/files/drupal_7_rdf_module_1.png" title="Drupal 7 - RDF Module" alt="Drupal 7 - RDF Module" width="500" height="99" /&gt;&lt;/p&gt;

	&lt;p&gt;For the most part, Drupal only renders what’s in your templates. But there are a few areas where it tends to wrap things in &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; tags that you might not want. Thankfully, Drupal’s theme system makes it easy to remedy. The following is a list of files that I have created, which contain &lt;strong&gt;only&lt;/strong&gt; the code necessary to generate your content, thereby overriding Drupal’s default output.&lt;/p&gt;

	&lt;p&gt;I have purposefully omitted the closing &lt;code&gt;?&amp;gt;&lt;/code&gt; tag, because it is considered a best practice (by both &lt;a href="http://drupal.org/coding-standards#phptags"&gt;Drupal&lt;/a&gt; and &lt;a href="http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html#coding-standard.php-file-formatting.general"&gt;Zend&lt;/a&gt;) to &lt;strong&gt;not&lt;/strong&gt; close the &lt;code&gt;&amp;lt;?php&lt;/code&gt; tag. Instead, the parser realizes the &lt;span class="caps"&gt;PHP&lt;/span&gt; code is finished when it has reached the end of the file. This prevents the unintentional injection of whitespace into a page. (Needless to say, &lt;code&gt;?&amp;gt;&lt;/code&gt; is still necessary when mixing &lt;span class="caps"&gt;PHP&lt;/span&gt; and &lt;span class="caps"&gt;HTML&lt;/span&gt; within the same file.)&lt;/p&gt;

	&lt;p&gt;Note: The templates that start with “views-” pertain to &lt;a href="http://drupal.org/project/views"&gt;Views&lt;/a&gt;, a third party Drupal module that makes it easy to output lists of content based on various criteria.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;block.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php print $content;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p class="notice"&gt;Note: I have removed &lt;code&gt;$item_attributes&lt;/code&gt; from my &lt;em&gt;field.tpl.php&lt;/em&gt; file. This is used by the &lt;span class="caps"&gt;RDF&lt;/span&gt; module, and can potentially be utilized by third party modules, to add things like &lt;code&gt;onclick="..."&lt;/code&gt; to various elements. I removed it because I am not using the &lt;span class="caps"&gt;RDF&lt;/span&gt; module, but your mileage may vary — &lt;a href="http://api.drupal.org/api/drupal/modules--field--field.module/function/theme_field/7"&gt;read more&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;field.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php print render($items);
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;region.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php print $content;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;views-view.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php
&lt;/code&gt;
&lt;code&gt;// Shorthand for if, then print.
// I write PHP like a JS hacker.
// Pager at the top, and bottom.
&lt;/code&gt;
&lt;code&gt;isset($admin_links) &amp;amp;&amp;amp; print $admin_links;
$header &amp;amp;&amp;amp; print $header;
$exposed &amp;amp;&amp;amp; print $exposed;
$attachment_before &amp;amp;&amp;amp; print $attachment_before;
$pager &amp;amp;&amp;amp; print $pager;
$rows ? print $rows : $empty &amp;amp;&amp;amp; print $empty;
$pager &amp;amp;&amp;amp; print $pager;
$attachment_after &amp;amp;&amp;amp; print $attachment_after;
$more &amp;amp;&amp;amp; print $more;
$footer &amp;amp;&amp;amp; print $footer;
$feed_icon &amp;amp;&amp;amp; print $feed_icon;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;views-view-unformatted.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php
&lt;/code&gt;
&lt;code&gt;$title &amp;amp;&amp;amp; print $title;
&lt;/code&gt;
&lt;code&gt;foreach ($rows as $id =&amp;gt; $row) {
  print $row;
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;views-view-list.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php
&lt;/code&gt;
&lt;code&gt;$title &amp;amp;&amp;amp; print $title;
&lt;/code&gt;
&lt;code&gt;print '&amp;lt;ul class="list"&amp;gt;';
&lt;/code&gt;
&lt;code&gt;foreach ($rows as $id =&amp;gt; $row) {
  print '&amp;lt;li&amp;gt;' . $row . '&amp;lt;/li&amp;gt;';
}
&lt;/code&gt;
&lt;code&gt;print '&amp;lt;/ul&amp;gt;';
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;views-view-fields.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php
&lt;/code&gt;
&lt;code&gt;foreach ($fields as $id =&amp;gt; $field) {
  if (isset($field-&amp;gt;separator)) {
    print $field-&amp;gt;separator;
  }
&lt;/code&gt;
&lt;code&gt;  print $field-&amp;gt;content;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;&lt;h2 id="_html_page_node"&gt;&lt;span class="caps"&gt;HTML&lt;/span&gt;, Page, Node&lt;/h2&gt;

	&lt;p&gt;Though the aforementioned files pertaining to &lt;em&gt;block&lt;/em&gt;, &lt;em&gt;field&lt;/em&gt;, &lt;em&gt;region&lt;/em&gt;, and &lt;em&gt;views&lt;/em&gt; are all technically templates, in that they end in &lt;em&gt;*.tpl.php&lt;/em&gt;, the crux of the templating system revolves around &lt;span class="caps"&gt;HTML&lt;/span&gt;, page, and node templates.&lt;/p&gt;

	&lt;p&gt;Below, I have listed out the majority of my template code. You may notice I did not include my &lt;em&gt;page‐‐front.tpl.php&lt;/em&gt; file. It is mostly hard coded because it does not change that often, with the only dynamic part being recent journal entries.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;html.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset="utf-8" /&amp;gt;
&amp;lt;meta http-equiv="x-ua-compatible" content="ie=edge, chrome=1" /&amp;gt;
&amp;lt;title&amp;gt;&amp;lt;?php
  if (sonspring_section() === 'section_home') {
    print 'SonSpring by Nathan Smith';
  }
  else {
    print $head_title;
  }
?&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;!--[if lt IE 8]&amp;gt;
&amp;lt;script&amp;gt;
window.top.location = 'http://desktop.sonspring.com/ie.html';
&amp;lt;/script&amp;gt;
&amp;lt;![endif]--&amp;gt;
&amp;lt;meta name="author" content="Nathan Smith"&amp;gt;
&amp;lt;meta name="description" content="Personal and professional home of Christian web designer Nathan Smith." /&amp;gt;
&amp;lt;link rel="alternate" type="application/rss+xml" title="SonSpring RSS" href="http://feeds.feedburner.com/sonspring" /&amp;gt;
&amp;lt;link rel="shortcut icon" type="image/x-icon" href="/sites/all/themes/sonspring/assets/images/favicon.ico" /&amp;gt;
&amp;lt;link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald" /&amp;gt;
&amp;lt;?php print $styles; ?&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body id="&amp;lt;?php print sonspring_section(); ?&amp;gt;"&amp;gt;
&amp;lt;?php
  print $page_top;
  print $page;
  print $scripts;
  print $page_bottom;
?&amp;gt;
&amp;lt;script async="async" src="http://mint.sonspring.com/?js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;page.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id="wrapper"&amp;gt;
  &amp;lt;?php include 'assets/includes/header.inc'; ?&amp;gt;
  &amp;lt;div id="main" class="container_12"&amp;gt;
    &amp;lt;div class="grid_10"&amp;gt;
      &amp;lt;h1&amp;gt;&amp;lt;?php print $title; ?&amp;gt;&amp;lt;/h1&amp;gt;
      &amp;lt;?php $tabs &amp;amp;&amp;amp; print render($tabs); ?&amp;gt;
      &amp;lt;div class="grid_7 alpha"&amp;gt;
        &amp;lt;?php print render($page['content']); ?&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div class="grid_3 omega aside"&amp;gt;
        &amp;lt;?php $page['sidebar_first'] &amp;amp;&amp;amp; print render($page['sidebar_first']); ?&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="grid_2 aside"&amp;gt;
      &amp;lt;?php
        include 'assets/includes/fusion.inc';
        $page['sidebar_second'] &amp;amp;&amp;amp; print render($page['sidebar_second']);
      ?&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;?php include 'assets/includes/footer.inc';
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;page‐‐search.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id="wrapper"&amp;gt;
  &amp;lt;?php include 'assets/includes/header.inc'; ?&amp;gt;
  &amp;lt;div id="main" class="container_12"&amp;gt;
    &amp;lt;div class="grid_10"&amp;gt;
      &amp;lt;h1&amp;gt;&amp;lt;?php print $title; ?&amp;gt;&amp;lt;/h1&amp;gt;
      &amp;lt;?php
        $tabs &amp;amp;&amp;amp; print render($tabs);
        $page['content'] &amp;amp;&amp;amp; print render($page['content']);
      ?&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="grid_2 aside"&amp;gt;
      &amp;lt;?php
        include 'assets/includes/fusion.inc';
        $page['sidebar_second'] &amp;amp;&amp;amp; print render($page['sidebar_second']);
      ?&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;?php include 'assets/includes/footer.inc';
&lt;/code&gt;&lt;/pre&gt;

	&lt;p class="notice"&gt;Note: In &lt;em&gt;node.tpl.php&lt;/em&gt;, I removed &lt;code&gt;$attributes&lt;/code&gt;, &lt;code&gt;$title_attributes&lt;/code&gt;, and &lt;code&gt;$content_attributes&lt;/code&gt;, used for &lt;span class="caps"&gt;RDF&lt;/span&gt;. For a pristine &lt;em&gt;node.tpl.php&lt;/em&gt; — &lt;a href="http://api.drupal.org/api/drupal/modules--node--node.tpl.php/7/source"&gt;source&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;node.tpl.php&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php
  !empty($content['upload']) &amp;amp;&amp;amp; hide($content['upload']);
  !empty($content['taxonomy_vocabulary_1']) &amp;amp;&amp;amp; hide($content['taxonomy_vocabulary_1']);
  !empty($content['links']) &amp;amp;&amp;amp; hide($content['links']);
?&amp;gt;
&amp;lt;div class="node clearfix"&amp;gt;
  &amp;lt;?php if (!$page) { ?&amp;gt;
    &amp;lt;?php print render($title_prefix); ?&amp;gt;
    &amp;lt;h2&amp;gt;
      &amp;lt;a href="&amp;lt;?php print $node_url; ?&amp;gt;"&amp;gt;&amp;lt;?php print $title; ?&amp;gt;&amp;lt;/a&amp;gt;
    &amp;lt;/h2&amp;gt;
    &amp;lt;?php print render($title_suffix); ?&amp;gt;
  &amp;lt;?php } ?&amp;gt;
  &amp;lt;?php if ($submitted) { ?&amp;gt;
    &amp;lt;?php if ($page) { ?&amp;gt;
      &amp;lt;div class="g_plus"&amp;gt;&amp;lt;div class="g-plusone" data-size="small" data-count="false"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;?php } ?&amp;gt;
    &amp;lt;div class="meta mute"&amp;gt;
      &amp;lt;span class="submitted"&amp;gt;
        &amp;lt;?php print format_date($node-&amp;gt;created); ?&amp;gt;
      &amp;lt;/span&amp;gt;
      &amp;amp;mdash;
      Topic:
      &amp;lt;?php print render($content['taxonomy_vocabulary_1']); ?&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;?php } ?&amp;gt;
  &amp;lt;?php
    print render($content);
    print render($content['links']);
  ?&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;&lt;h2 id="_includes"&gt;Includes&lt;/h2&gt;

	&lt;p&gt;For the sake of completeness, I figured I ought to finish by listing out the contents of my &lt;em&gt;*.inc&lt;/em&gt; files, contained within an &lt;em&gt;includes&lt;/em&gt; directory under &lt;em&gt;assets&lt;/em&gt;. While these files could have just as easily been left in the higher level &lt;em&gt;*.tpl.php&lt;/em&gt; files, to ease in maintainability and in an effort to adhere to &lt;abbr title="Don’t Repeat Yourself"&gt;&lt;span class="caps"&gt;DRY&lt;/span&gt;&lt;/abbr&gt; principles, I separated them out into their own files. By having the file extension &lt;em&gt;*.inc&lt;/em&gt;, Drupal knows to disallow direct browsing, so they can only be used via inclusion in a &lt;span class="caps"&gt;PHP&lt;/span&gt; page.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;header.inc&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id="header"&amp;gt;
  &amp;lt;div class="container_12"&amp;gt;
    &amp;lt;div class="grid_3" id="ss_logo"&amp;gt;
      &amp;lt;?php
        if (!$is_front) {
          print '&amp;lt;a href="/"&amp;gt;';
        }
&lt;/code&gt;
&lt;code&gt;        print '&amp;lt;span&amp;gt;SonSpring&amp;lt;/span&amp;gt;';
&lt;/code&gt;
&lt;code&gt;        if (!$is_front) {
          print '&amp;lt;/a&amp;gt;';
        }
      ?&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="grid_7"&amp;gt;
      &amp;lt;ul id="nav"&amp;gt;
        &amp;lt;li id="nav_journal"&amp;gt;
          &amp;lt;a href="/journal"&amp;gt;Journal&amp;lt;/a&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li id="nav_about"&amp;gt;
          &amp;lt;a href="/about"&amp;gt;About&amp;lt;/a&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li id="nav_work"&amp;gt;
          &amp;lt;a href="/work"&amp;gt;Work&amp;lt;/a&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li id="nav_resources"&amp;gt;
          &amp;lt;a href="/resources"&amp;gt;Resources&amp;lt;/a&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li id="nav_contact"&amp;gt;
          &amp;lt;a href="/contact"&amp;gt;Contact&amp;lt;/a&amp;gt;
        &amp;lt;/li&amp;gt;
      &amp;lt;/ul&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="grid_2"&amp;gt;
      &amp;lt;?php
        if ($page['search'] &amp;amp;&amp;amp; sonspring_section() !== 'section_search') {
          print render($page['search']);
        }
      ?&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;fusion.inc&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;a href="http://fusionads.net/" id="fusion_link"&amp;gt;Powered by Fusion Ads&amp;lt;/a&amp;gt;
&amp;lt;div id="fusion_ad"&amp;gt;&amp;lt;span class="clear"&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;footer.inc&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id="footer"&amp;gt;
  &amp;lt;div class="container_12"&amp;gt;
    &amp;lt;div class="grid_4"&amp;gt;
      &amp;amp;copy; &amp;lt;?php print date('Y'); ?&amp;gt; &amp;lt;a href="https://profiles.google.com/sonspring/about"&amp;gt;Nathan Smith&amp;lt;/a&amp;gt;. All rights reserved.
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="grid_4"&amp;gt;
      &amp;lt;a href="http://www.firehost.com/?ref=spon_nsmith_sonspring" title="Secure Hosting" id="hosted_by_firehost"&amp;gt;Hosted by FireHost&amp;lt;/a&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="grid_4 align_right"&amp;gt;
      &amp;lt;a href="http://feeds.feedburner.com/sonspring"&amp;gt;Subscribe&amp;lt;/a&amp;gt; via RSS. Follow me on &amp;lt;a href="http://twitter.com/nathansmith"&amp;gt;Twitter&amp;lt;/a&amp;gt;.
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;&lt;h2 id="_conclusion"&gt;Conclusion&lt;/h2&gt;

	&lt;p&gt;While all that might seem like a lot of code at first glance, keep in mind that’s pretty much the &lt;em&gt;entirety&lt;/em&gt; of my site’s theme (aside from &lt;span class="caps"&gt;CSS&lt;/span&gt; and light JavaScript). Once you get the hang of how it works, the Drupal theming system really not that difficult to understand. Plus, you’re learning real &lt;span class="caps"&gt;PHP&lt;/span&gt;, not pseudo code.&lt;/p&gt;

	&lt;p&gt;I wouldn’t say &lt;a href="http://drupal.org/"&gt;Drupal&lt;/a&gt; is perfect, but it offers extensibility via simple overrides. By far, it is the most intuitive approach I’ve found in my meandering quest for the ideal &lt;abbr title="Content Management System"&gt;&lt;span class="caps"&gt;CMS&lt;/span&gt;&lt;/abbr&gt;. Hopefully this walkthrough has helped dispel the myth that Drupal’s learning curve is “steep,” or at least made the process seem less daunting.&lt;/p&gt;

	&lt;p class="notice"&gt;This article has been translated into &lt;a href="http://softdroid.net/html5-drupal-7"&gt;Ukrainian&lt;/a&gt; by Vlad Brown of &lt;a href="http://softdroid.net/"&gt;Android Eclipse&lt;/a&gt;.&lt;/p&gt;</description>
 <pubDate>Sun, 22 May 2011 02:49:19 +0000</pubDate>
 <dc:creator>Nathan Smith</dc:creator>
 <guid isPermaLink="false">340 at http://sonspring.com</guid>
</item>
<item>
 <title>Adapt JS Explained</title>
 <link>http://sonspring.com/journal/adapt-js-explained</link>
 <description>&lt;a href="/topic/javascript"&gt;JavaScript&lt;/a&gt;	&lt;p class="notice"&gt;This explains the origins of, and how to use, &lt;a href="http://adapt.960.gs/"&gt;Adapt.js&lt;/a&gt; – (skip to &lt;a href="http://sonspring.com/journal/adapt-js-explained#how-to-use"&gt;How to use&lt;/a&gt;)&lt;/p&gt;

	&lt;h2&gt;First Off&lt;/h2&gt;

	&lt;p&gt;Let me say specifically that Adapt.js does not purport to be &lt;a href="http://www.alistapart.com/articles/responsive-web-design/"&gt;Responsive Web Design&lt;/a&gt;. The definition of &lt;abbr title="Responsive Web Design"&gt;&lt;span class="caps"&gt;RWD&lt;/span&gt;&lt;/abbr&gt;, as &lt;a href="http://ethanmarcotte.com/"&gt;Ethan Marcotte&lt;/a&gt; initially described it, specifically involves using both: fluid widths &lt;em&gt;and&lt;/em&gt; &lt;a href="http://www.w3.org/TR/css3-mediaqueries/"&gt;@media queries&lt;/a&gt;. He has further clarified this point through discussions on &lt;a href="http://twitter.com/beep"&gt;Twitter&lt;/a&gt;, posts on his &lt;a href="http://unstoppablerobotninja.com/entry/henry/"&gt;blog&lt;/a&gt; and public &lt;a href="http://aneventapart.com/speakers/ethanmarcotte/"&gt;presentations&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;I just wanted to be clear that I never tagged Adapt.js as “responsive” – and preemptively (before launching Adapt.js) assured Ethan privately via email that I would not attempt to muddy the waters. Nevertheless, some have made that association on their own. I emphasize this distinction because I don’t want Ethan’s &lt;span class="caps"&gt;RWD&lt;/span&gt; efforts (or &lt;a href="http://www.abookapart.com/products/responsive-web-design"&gt;book&lt;/a&gt;) to go the way of &lt;a href="http://www.w3.org/html/logo/"&gt;HTML5&lt;/a&gt;, where marketers grab ahold of the term, and repurpose it to mean whatever is bright, shiny, and new.&lt;/p&gt;

	&lt;h3&gt;Waxing Poetic&lt;/h3&gt;

	&lt;p&gt;If anything, Adapt.js heralds from back alleys of the old-school. It depends not on CSS3, but on properties that can be reliably detected using JS – across multiple versions of multiple browsers, on multiple devices. Considering that @media queries require a &lt;a href="https://github.com/scottjehl/Respond"&gt;polyfill&lt;/a&gt; for older browsers, namely everything up to (and including) &lt;abbr title="Internet Explorer 8"&gt;IE8&lt;/abbr&gt;, JavaScript has to be involved either way. That may seem like backwards thinking, but remember that JavaScript predates the existence of &lt;span class="caps"&gt;CSS&lt;/span&gt; anyway.&lt;/p&gt;

	&lt;p&gt;Don’t get me wrong, I certainly see the appeal of being able to manage everything via &lt;span class="caps"&gt;CSS&lt;/span&gt;. In fact, before learning JavaScript, I used to pride myself on really knowing &lt;span class="caps"&gt;CSS&lt;/span&gt; (before the days of &lt;span class="caps"&gt;CSS&lt;/span&gt; frameworks). After dabbling in JavaScript, I realized something. Now it’s a point I’ve made repeatedly, with aspiring front-end developers and designers, about rounding out one’s skill-set…&lt;/p&gt;

	&lt;blockquote&gt;
		&lt;p&gt;Mastering &lt;span class="caps"&gt;CSS&lt;/span&gt; is akin to building amazing things with Legos. Understanding JavaScript is like manufacturing Legos. Though related, they are simultaneously altogether different.&lt;/p&gt;
	&lt;/blockquote&gt;

	&lt;p&gt;But I digress. When I first read Ethan’s post, I whipped up a (failed) experiment to see if specifying &lt;code&gt;media="..."&lt;/code&gt; could be used to conditionally serve/block &lt;span class="caps"&gt;CSS&lt;/span&gt; files, based on browser width. If you’re curious, that can be seen here…&lt;/p&gt;

	&lt;p&gt;&lt;a href="http://host.sonspring.com/media_queries/"&gt;http://host.sonspring.com/media_queries&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;I was disappointed to learn that as with &lt;code&gt;media="print"&lt;/code&gt; stylesheets, the entirety of the code is downloaded by the browser, on the off-chance it might be needed. Unlike the tech savvy web developers amongst us, the majority of the general public do not constantly resize their browsers looking for easter eggs.&lt;/p&gt;

	&lt;h3&gt;Grey’s&lt;/h3&gt;

	&lt;p&gt;So instead, I decided to let the idea sit on the shelf for awhile. Until, one evening while watching &lt;a href="http://en.wikipedia.org/wiki/Grey's_Anatomy"&gt;Grey’s Anatomy&lt;/a&gt; via &lt;a href="http://www.netflix.com/"&gt;Netflix&lt;/a&gt; with my wife, it hit me. If I am really concerned about testing for width, why not test for width, using an age-old technique? (“Old” is relative, when we’re talking about the Internet.)&lt;/p&gt;

	&lt;p&gt;So I grabbed my laptop and whipped up what ended up being a less than 1KB (minified) snippet of JavaScript that would conditionally create …&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;link rel="stylesheet" href="..." /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;… based on browser width. Over the next few evenings, I whittled down to the essential code. A few weeks later, based on a few requests via Twitter and GitHub, I added the ability to specify a callback function that fires as the page loads/resizes. This allows your code to take action once Adapt.js does its work.&lt;/p&gt;

	&lt;p&gt;Note: As cheesy as TV medical dramas might be, I mention that the idea came whilst distracted, because sometimes our most inspirational moments hit us when we’re not actively looking for them, but are engaged in passive thought.&lt;/p&gt;

 &lt;hr id="how-to-use" /&gt;&lt;h2&gt;How To Use&lt;/h2&gt;

	&lt;p class="notice"&gt;In all the following examples, feel free to drop the “px” suffix. It is just there to emphasize that the calculations done by Adapt.js are pixel-based.&lt;/p&gt;

	&lt;p&gt;At the bare minimum, if all you want is to serve just the &lt;span class="caps"&gt;CSS&lt;/span&gt; needed on page load, but not worry about browser resize and whatnot, all you’d really need is this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var ADAPT_CONFIG = {
  path: 'assets/css/',
  range: [
    '0px    to 760px  = mobile.css',
    '760px  to 980px  = 720.css',
    '980px  to 1280px = 960.css',
    '1280px to 1600px = 1200.css',
    '1600px to 1920px = 1560.css',
    '1920px           = fluid.css'
  ]
};
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Bear in mind, you needn’t use these naming conventions for your &lt;span class="caps"&gt;CSS&lt;/span&gt; files. “720.css” could just as easily be “peanut_butter.css” or any other name.&lt;/p&gt;

	&lt;p&gt;Now let’s suppose you want to put all your mobile styles in your main stylesheet, and &lt;em&gt;only&lt;/em&gt; add extra styles above a certain width threshold. The following code is basically saying “If the width is greater than 760px, add desktop.css.” Adapt.js knows this, because it’s the last (only) entry in the range array.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var ADAPT_CONFIG = {
  path: 'assets/css/',
  range: [
    '760px = desktop.css'
  ]
};
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;If you want to adapt to browser resize and device tilt, add the &lt;code&gt;dynamic&lt;/code&gt; flag.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var ADAPT_CONFIG = {
  path: 'assets/css/',
  dynamic: true,
  range: [
    '760px = desktop.css'
  ]
};
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Callback&lt;/h3&gt;

	&lt;p&gt;For JS you want to fire when the page resizes, specify a callback function.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var ADAPT_CONFIG = {
  path: 'assets/css/',
  dynamic: true,
  callback: myCallback,
  range: [
    '0px    to 760px  = mobile.css',
    '760px  to 980px  = 720.css',
    '980px  to 1280px = 960.css',
    '1280px to 1600px = 1200.css',
    '1600px to 1920px = 1560.css',
    '1920px           = fluid.css'
  ]
};
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;If you don’t want to swap &lt;span class="caps"&gt;CSS&lt;/span&gt; files, simply leave them out, and don’t specify &lt;code&gt;path&lt;/code&gt;. That will still allow you take advantage of Adapt.js to trigger a callback function.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var ADAPT_CONFIG = {
  dynamic: true,
  callback: myCallback,
  range: [
    '0    to 760',
    '760  to 980',
    '980  to 1280',
    '1280 to 1600',
    '1600 to 1920',
    '1920'
  ]
};
&lt;/code&gt;&lt;/pre&gt;

	&lt;h4&gt;&lt;span class="caps"&gt;HTML&lt;/span&gt; ~ Class Name&lt;/h4&gt;

	&lt;p&gt;&lt;a href="http://adapt.960.gs/test_class.html"&gt;&lt;span class="caps"&gt;VIEW&lt;/span&gt; &lt;span class="caps"&gt;DEMO&lt;/span&gt; – Class Name&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;The callback is passed &lt;code&gt;range&lt;/code&gt; index and width — &lt;code&gt;myCallback(i, width)&lt;/code&gt;. Based on that info, you could do any number of things. One common use case, I’m assuming, would be to add a class name to the &lt;span class="caps"&gt;HTML&lt;/span&gt; tag. That would allow you to make slight tweaks, via descendant selectors in your master &lt;span class="caps"&gt;CSS&lt;/span&gt; file.&lt;/p&gt;

	&lt;p&gt;For the sake of discussion, I’m using the function name &lt;code&gt;myCallback&lt;/code&gt;. However, you could just as easily name your callback function &lt;code&gt;myLittlePony&lt;/code&gt;, &lt;code&gt;captainAmerica&lt;/code&gt;, or specify it as part of an application namespace like &lt;code&gt;MY.app.adapt_callback&lt;/code&gt;.&lt;/p&gt;

	&lt;p&gt;In the example below, &lt;code&gt;i&lt;/code&gt; is the index of the range array. Since arrays in JS (really, every language) are zero indexed, this means that the first one would be 0, the second would be 1, etc. Don’t blame me, I didn’t make the rules!&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function myCallback(i, width) {
  // Alias HTML tag.
  var html = document.documentElement;
&lt;/code&gt;
&lt;code&gt;  // Find all instances of range_NUMBER and kill 'em.
  html.className = html.className.replace(/(\s+)?range_\d/g, '');
&lt;/code&gt;
&lt;code&gt;  // Check for valid range.
  if (i &amp;gt; -1) {
    // Add class="range_NUMBER"
    html.className += ' range_' + i;
  }
&lt;/code&gt;
&lt;code&gt;  // Note: Not making use of width here, but I'm sure
  // you could think of an interesting way to use it.
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;In your master &lt;span class="caps"&gt;CSS&lt;/span&gt; file, you could do style overrides, like so…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;.foobar {
  /* Default styles here. */
}
&lt;/code&gt;
&lt;code&gt;html.range_0 .foobar {
  /* Style overrides for: 0px to 760px */
}
&lt;/code&gt;
&lt;code&gt;html.range_1 .foobar {
  /* Style overrides for: 760px to 980px */
}
&lt;/code&gt;
&lt;code&gt;/* etc. */
&lt;/code&gt;&lt;/pre&gt;

	&lt;h4&gt;&lt;span class="caps"&gt;HTML&lt;/span&gt; ~ ID&lt;/h4&gt;

	&lt;p&gt;&lt;a href="http://adapt.960.gs/test_id.html"&gt;&lt;span class="caps"&gt;VIEW&lt;/span&gt; &lt;span class="caps"&gt;DEMO&lt;/span&gt; – ID&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;If you prefer to use an &lt;code&gt;id&lt;/code&gt; selector instead, assuming you don’t already have something like &lt;code&gt;id="example_com"&lt;/code&gt; or &lt;code&gt;id="example_org"&lt;/code&gt; on your &lt;span class="caps"&gt;HTML&lt;/span&gt; tag, you could define an extremely simple callback function. Like so…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function myCallback(i) {
  // Replace HTML tag's ID.
  document.documentElement.id = 'range_' + i;
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;That yields a stronger &lt;span class="caps"&gt;CSS&lt;/span&gt; selector to style against (&lt;code&gt;id&lt;/code&gt; trumps &lt;code&gt;class&lt;/code&gt;).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;html#range_0 .foobar {
  /* Style overrides for: 0px to 760px */
}
&lt;/code&gt;
&lt;code&gt;/* etc. */
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;That’s just one example. Your callback could do whatever you want, allowing the file size of Adapt.js to remain lightweight. Just make sure to define your callback function before referencing the &lt;code&gt;adapt.js&lt;/code&gt; file, so that it will be recognized.&lt;/p&gt;

 &lt;hr /&gt;&lt;h4&gt;That’s a Wrap&lt;/h4&gt;

	&lt;p&gt;I think that about covers it. It is my sincere hope that Adapt.js will help alleviate some development woes. If you think I’ve left anything out, feel free to &lt;a href="http://sonspring.com/contact"&gt;contact&lt;/a&gt; me and/or hit me up on &lt;a href="http://twitter.com/nathansmith"&gt;Twitter&lt;/a&gt;. I will do my best to answer any questions.&lt;/p&gt;</description>
 <pubDate>Sat, 14 May 2011 20:35:33 +0000</pubDate>
 <dc:creator>Nathan Smith</dc:creator>
 <guid isPermaLink="false">339 at http://sonspring.com</guid>
</item>
<item>
 <title>How I Do Form Layouts</title>
 <link>http://sonspring.com/journal/how-i-do-form-layouts</link>
 <description>&lt;a href="/topic/html"&gt;HTML&lt;/a&gt;	&lt;p&gt;I originally posted this as a &lt;a href="http://forrst.com/posts/Markup_for_semantic_HTML_forms-DyN#comment-295284"&gt;comment&lt;/a&gt; on &lt;a href="http://forrst.com/"&gt;Forrst&lt;/a&gt;, but since comments are only viewable by Forrst members, I am re-posting it here. Really, it’s no big deal, and is pretty old-school. I just figured it might help with people beating their heads against a desk, attempting form layouts using &lt;code&gt;float&lt;/code&gt;. Hint: don’t bother.&lt;/p&gt;

 &lt;hr /&gt;&lt;p&gt;Note: I’m not here to argue. I’m posting specifically because I was asked (by the author of this post/question) for my opinion via Twitter. :)&lt;/p&gt;

	&lt;p&gt;&lt;a href="http://twitter.com/kom420/status/68728880294395905"&gt;http://twitter.com/kom420/status/68728880294395905&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;Depends on the layout I need, but I usually just go the paragraph route. Unless I need labels side-by-side with form elements, in which case the varying length (of label text) makes floats a pain. In that case, I’d do…&lt;/p&gt;

	&lt;h2&gt;Side-by-side layout&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;form accept="..." action="..." method="..."&amp;gt;
  &amp;lt;table class="form"&amp;gt;
    &amp;lt;tr&amp;gt;
      &amp;lt;th&amp;gt;
        &amp;lt;label for="input_1"&amp;gt;
          Label text
        &amp;lt;/label&amp;gt;
      &amp;lt;/th&amp;gt;
      &amp;lt;td&amp;gt;
        &amp;lt;input type="text" id="input_1" name="input_1" /&amp;gt;
      &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
    &amp;lt;tr&amp;gt;
      &amp;lt;th&amp;gt;
        &amp;lt;label for="input_2"&amp;gt;
          Label text
        &amp;lt;/label&amp;gt;
      &amp;lt;/th&amp;gt;
      &amp;lt;td&amp;gt;
        &amp;lt;input type="text" id="input_2" name="input_2" /&amp;gt;
      &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
    &amp;lt;tr&amp;gt;
      &amp;lt;th&amp;gt;
        &amp;amp;nbsp;
      &amp;lt;/th&amp;gt;
      &amp;lt;td&amp;gt;
        &amp;lt;input type="submit" value="Submit" /&amp;gt;
      &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
  &amp;lt;/table&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Now, before anyone cries “unsemantic” — Note that this is about ease of maintenance. Floats with fixed-widths on labels only work so well, until the label gets longer. It’s just not worth the hassel to constantly re-visit the &lt;span class="caps"&gt;CSS&lt;/span&gt; because of form elements changing. I’m speaking from experience, having worked at a &lt;a href="http://www.albertsons.com/"&gt;Fortune 50&lt;/a&gt; company previously (and now a &lt;a href="http://www.hp.com/"&gt;Fortune 10&lt;/a&gt; co.), where that type of stuff is not always under your control.&lt;/p&gt;

	&lt;p&gt;Also worth noting, is that most (maybe all?) assistive devices (screen readers) go into a different reading mode when speaking &lt;code&gt;form&lt;/code&gt; content, so the &lt;code&gt;table&lt;/code&gt; does not throw off its interpretation. Instead, it reads &lt;code&gt;label&lt;/code&gt; and &lt;code&gt;input&lt;/code&gt; combinations.&lt;/p&gt;

	&lt;p&gt;For the &lt;span class="caps"&gt;CSS&lt;/span&gt;, to force the &lt;code&gt;th&lt;/code&gt; to be as narrow as possible, I do this…&lt;/p&gt;

	&lt;p&gt;(See form example on &lt;a href="http://formalize.me/"&gt;Formalize.me&lt;/a&gt; for an approximation)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;.form th {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Stacked Layout&lt;/h2&gt;

	&lt;p&gt;Oh, and if I’m doing a stacked approach, where each label is above its respective input, I do this…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;form accept="..." action="..." method="..."&amp;gt;
  &amp;lt;fieldset&amp;gt;
    &amp;lt;legend&amp;gt;
      Group 1
    &amp;lt;/legend&amp;gt;
    &amp;lt;p&amp;gt;
      &amp;lt;label for="input_1"&amp;gt;
        Label text
      &amp;lt;/label&amp;gt;
      &amp;lt;br /&amp;gt;
      &amp;lt;input type="text" id="input_1" name="input_1"&amp;gt;
    &amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;
      &amp;lt;label for="input_2"&amp;gt;
        Label text
      &amp;lt;/label&amp;gt;
      &amp;lt;br /&amp;gt;
      &amp;lt;input type="text" id="input_2" name="input_2"&amp;gt;
    &amp;lt;/p&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;fieldset&amp;gt;
    &amp;lt;legend&amp;gt;
      Group 2
    &amp;lt;/legend&amp;gt;
    &amp;lt;p&amp;gt;
      &amp;lt;label for="input_3"&amp;gt;
        Label text
      &amp;lt;/label&amp;gt;
      &amp;lt;br /&amp;gt;
      &amp;lt;input type="text" id="input_3" name="input_3"&amp;gt;
    &amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;
      &amp;lt;label for="input_4"&amp;gt;
        Label text
      &amp;lt;/label&amp;gt;
      &amp;lt;br /&amp;gt;
      &amp;lt;input type="text" id="input_4" name="input_4"&amp;gt;
    &amp;lt;/p&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;p&amp;gt;
    &amp;lt;input type="submit" value="Submit" /&amp;gt;
  &amp;lt;/p&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;With a bit of &lt;span class="caps"&gt;CSS&lt;/span&gt; (via sibling selector) to increase the spacing between the label and the input for browsers that understand it (Note: doesn’t work in IE6)…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;br + input,
br + select,
br + textarea {
  margin-top: 5px;
}
&lt;/code&gt;&lt;/pre&gt;</description>
 <pubDate>Thu, 12 May 2011 18:37:49 +0000</pubDate>
 <dc:creator>Nathan Smith</dc:creator>
 <guid isPermaLink="false">338 at http://sonspring.com</guid>
</item>
<item>
 <title>Drupal 7 Module Development</title>
 <link>http://sonspring.com/journal/drupal-7-module-development</link>
 <description>&lt;a href="/topic/product-review"&gt;Product Review&lt;/a&gt;	&lt;p&gt;&lt;a href="https://www.packtpub.com/drupal-7-module-development/book"&gt;&lt;img src="/sites/default/files/drupal_7_module_development.png" class="picture" title="Drupal 7 Module Development" alt="Drupal 7 Module Development" width="100" height="124" /&gt;&lt;/a&gt; While I consider myself well-versed at the front-end theme aspects of Drupal, I had been wanting to delve a little deeper into its underpinnings, if only to understand how modules work. Deconstructed, Drupal is essentially a series of modules working together — be that “core,” the bare &lt;abbr title="Content Management System"&gt;&lt;span class="caps"&gt;CMS&lt;/span&gt;&lt;/abbr&gt; — or “contrib,” third party modules available for download from &lt;a href="http://drupal.org/"&gt;drupal.org&lt;/a&gt;. So, in an effort to bolster my skill set, I recently read &lt;a href="https://www.packtpub.com/drupal-7-module-development/book"&gt;Drupal 7 Module Development&lt;/a&gt;, from &lt;a href="http://packtpub.com/"&gt;Packt Publishing&lt;/a&gt; and found it to be an excellent resource.&lt;/p&gt;

	&lt;p&gt;If you have more than a passing interest in Drupal, then you are probably aware of the significance of such a talented group of developers collaborating on this book. The author list reads like a veritable who’s who in the subculture of Drupal…&lt;/p&gt;

	&lt;ul&gt;&lt;li&gt;&lt;a href="http://technosophos.com/"&gt;Matt Butcher&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.garfieldtech.com/"&gt;Larry Garfield&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;John Wilkins – &lt;em&gt;aka&lt;/em&gt; &lt;a href="http://john.albin.net/"&gt;John Albin&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mattfarina.com/"&gt;Matt Farina&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://ken.therickards.com/"&gt;Ken Rickard&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://heyrocker.com/"&gt;Greg Dunlap&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;&lt;p&gt;Matt Butcher works for the &lt;a href="http://www.nytco.com/"&gt;New York Times Company&lt;/a&gt; on their &lt;a href="http://www.consumersearch.com/"&gt;ConsumerSearch&lt;/a&gt; site. Greg Dunlap works for &lt;a href="http://nodeone.se"&gt;NodeOne&lt;/a&gt;, an agency in Sweden. The rest of the authors are heavy hitters at &lt;a href="http://palantir.net/"&gt;Palantir&lt;/a&gt;, a development firm based in Chicago.&lt;/p&gt;

	&lt;p&gt;This book does not mince words, skipping past the whole installation process, because such &lt;a href="http://drupal.org/documentation/install"&gt;information&lt;/a&gt; is readily available online anyway. What I like best about this book is that, after the requisite introductory chapter covering the broad strokes, it gets right into building a module from scratch, aptly named &lt;em&gt;First&lt;/em&gt;, that outputs a list of all the currently installed modules. Chapter 2 also touches on code standards (covered &lt;a href="http://drupal.org/coding-standards"&gt;here&lt;/a&gt;), as well as how to write automated unit tests.&lt;/p&gt;

	&lt;p&gt;Chapter 3 is all about theming, and not just at a superficial stylistic level, but also how to make use of powerful preprocess functions, that allow the theme layer to edit Drupal’s output before it reaches the browser. I have implemented such techniques to make my own site HTML5, rather than the default &lt;span class="caps"&gt;XHTML&lt;/span&gt; 1.0.&lt;/p&gt;

	&lt;p&gt;With module building and theming covered, chapter 4 jumps into how to theme a module, because modules themselves typically output a varying degree of markup themselves, and can (optionally) ship with &lt;span class="caps"&gt;CSS&lt;/span&gt; to handle any custom styling. Also covered is consideration for languages that read right to left, as internationalization has been a priority even since the earliest days of Drupal. Such cases should not be overlooked if you intend to make your module publicly available for reuse.&lt;/p&gt;

	&lt;p&gt;Chapter 5 draws back the curtain a bit, so to speak, venturing into the administrative interface. Some modules do not actually affect a site’s public look and feel at all, but instead are built to facilitate a content creation workflow and/or user management. This chapter covers how to write an admin module that makes use of Drupal’s email &lt;span class="caps"&gt;API&lt;/span&gt;, sending the user a warning message if he or she is deemed to be in violation of the site’s terms of service.&lt;/p&gt;

	&lt;p&gt;Chapters 6 and 7 cover how to work with custom content and field types, using &lt;em&gt;artwork&lt;/em&gt; as an example of a special type of content (ch. 6), with the &lt;em&gt;dimensions&lt;/em&gt; of each piece of artwork necessitating a custom field type (ch. 7). The authors are quick to point out that Drupal itself is versatile enough to handle such cases, without needing a custom module. However, they chose this as a faux case study, simply to explain building modules that handle custom content and fields.&lt;/p&gt;

	&lt;p&gt;Chapters 8 and 9 cover permissions and security, as well as node access. One thing I have always appreciated about the community of developers around Drupal is the dedicated &lt;a href="http://drupal.org/security-team"&gt;security team&lt;/a&gt;. Chapters 8 takes the same mindset, that any anonymous site visitors could potentially be nefarious, and explains the best ways to ensure that you are not leaving your site vulnerable due to exploit vectors in your module. Additionally, chapter 9 talks about conditionally showing content to various user tiers, depending on if they have the necessary credentials to view it.&lt;/p&gt;

	&lt;p&gt;Chapter 10 is all about JavaScript, explaining that Drupal makes &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; and &lt;a href="http://jqueryui.com/"&gt;jQuery UI&lt;/a&gt; available to you as a developer. For instance, via jQuery, Drupal automatically adds a draggable handle that makes any &lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt; resizable in all browsers, even those that don’t natively support it. When building your own modules, you can also tap into the convenience that jQuery affords. This chapter covers how to employ an &lt;a href="http://www.adaptivepath.com/ideas/e000385"&gt;Ajax&lt;/a&gt; approach to forms, rather than doing a full round trip to the server to refresh the entire page. It also touches on how to add translation via &lt;code&gt;Drupal.t()&lt;/code&gt;, the JavaScript equivalent of Drupal’s &lt;span class="caps"&gt;PHP&lt;/span&gt; function &lt;code&gt;t()&lt;/code&gt;.&lt;/p&gt;

	&lt;p&gt;In chapter 11, working with files and images is explained. Whereas previous versions of Drupal required an additional module to be installed in order to manipulate images, as of Drupal 7, this functionality is built into core. As a module developer, you can tap into the native Image &lt;span class="caps"&gt;API&lt;/span&gt;, allowing users to manipulate graphics via a web interface. The authors explain the process of adding a watermark to a photo, as well as how to desaturate, rotate, and resize images.&lt;/p&gt;

	&lt;p&gt;You will love chapter 12 if you build a lot of Drupal powered sites, and find yourself repeatedly setting your preferred defaults each time. While not about module development, per se, it covers how to bundle modules and site configuration into what’s called an “install profile.” This allows you create a custom installation of Drupal, preconfigured with everything you would normally have to do anyway.&lt;/p&gt;

	&lt;p&gt;Basically, this book leaves no stone unturned. As if the aforementioned chapters weren’t already enough, at the end of the book, there are two appendices that cover databases and security, to be used more as a reference than a tutorial.&lt;/p&gt;

	&lt;p&gt;I would recommend &lt;a href="https://www.packtpub.com/drupal-7-module-development/book"&gt;Drupal 7 Module Development&lt;/a&gt; to anyone who has familiarity with building sites in Drupal, but wants to take their prowess to the next level. The collective expertise imparted in this book simply cannot be overstated.&lt;/p&gt;</description>
 <pubDate>Fri, 25 Mar 2011 22:44:15 +0000</pubDate>
 <dc:creator>Nathan Smith</dc:creator>
 <guid isPermaLink="false">337 at http://sonspring.com</guid>
</item>
<item>
 <title>Drupal 7 First Look</title>
 <link>http://sonspring.com/journal/drupal-7-first-look</link>
 <description>&lt;a href="/topic/product-review"&gt;Product Review&lt;/a&gt;	&lt;p&gt;&lt;a href="http://www.packtpub.com/drupal-7-first-look-at-new-features/book"&gt;&lt;img src="/sites/default/files/drupal_7_first_look.png" class="picture" title="" alt="" width="100" height="123" /&gt;&lt;/a&gt; I recently finished reading &lt;a href="http://www.packtpub.com/drupal-7-first-look-at-new-features/book"&gt;Drupal 7 First Look&lt;/a&gt; – written by &lt;a href="http://www.packtpub.com/authors/profiles/mark-noble"&gt;Mark Noble&lt;/a&gt; of &lt;a href="http://drupalbyexample.com/"&gt;Drupal by Example&lt;/a&gt;, and published by &lt;a href="http://www.packtpub.com/"&gt;Packt Publishing&lt;/a&gt;. I have to admit what while I was interested in learning more about Drupal 7, I was a bit skeptical about a book entitled “First Look,” concerned that perhaps it wouldn’t be substantive enough. However, since I have generally been pleased with the books I’ve read from Packt in the past, I decided this one might be worth reading.&lt;/p&gt;

	&lt;p&gt;I’m happy to say that this book not only lived up to it’s “at a glance” style title, but actually went into quite a bit of depth in several areas. While ideally suited to those who have some familiarity with Drupal 6, and want to know what’s changed in version 7, I believe this book would also be a good intro for those who are just starting to get into Drupal.&lt;/p&gt;

	&lt;p&gt;Noble aptly covered many facets of Drupal, from basic site building — configuring different content types and whatnot — to the new database abstraction layer, and building custom modules. The breadth of this book, and depth of its chapters, certainly quelled any uncertainty I had about the book possibly being &lt;em&gt;just&lt;/em&gt; a high-level overview.&lt;/p&gt;

	&lt;p&gt;Anyway, without simply running through the table of contents, I did want to highlight a few parts of this book that were particularly beneficial to me. Namely, just about everything in chapter 5: &lt;em&gt;Drupal 7 for Themers&lt;/em&gt;. Being a front-end developer by profession, this was of particular importance to me, because though I had thoroughly learned the ins-and-outs of theming for Drupal 6, there are significant differences in version 7.&lt;/p&gt;

	&lt;p&gt;For instance, rather than &lt;em&gt;page.tpl.php&lt;/em&gt; and/or &lt;em&gt;page-specific.tpl.php&lt;/em&gt; being the highest level template, there is now an &lt;em&gt;html.tpl.php&lt;/em&gt; file. This makes it a lot easier to have shared aspects across multiple page templates. Namely, things in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;, whereas in Drupal 6 this would have been repeated across all &lt;em&gt;page&lt;/em&gt; level templates. Now you need only specify your &lt;span class="caps"&gt;CSS&lt;/span&gt; and JavaScript once in the &lt;em&gt;html.tpl.php&lt;/em&gt; file.&lt;/p&gt;

	&lt;p&gt;Additionally, page templates for specific areas of a site now include two dashes. So what would have been:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;page-specific.tpl.php
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;… in Drupal 6 now has two dashes in the file name for Drupal 7:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;page--specific.tpl.php
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Little changes like this were documented well throughout the book.&lt;/p&gt;

	&lt;p&gt;I also appreciate how Noble broke down the various parts of a page template, specifically calling out &lt;em&gt;region.tpl.php&lt;/em&gt; as something that could be modified at the theme layer. This, along with &lt;em&gt;block.tpl.php&lt;/em&gt; enabled me to greatly simplify my site’s markup. Inspired by those quick wins, I even went so far as to revamp the output of the &lt;em&gt;Views&lt;/em&gt; module, via the various &lt;em&gt;views-*.tpl.php&lt;/em&gt; files it responds to.&lt;/p&gt;

	&lt;p&gt;Translation: My own site, powered by Drupal 7, now renders &lt;em&gt;only&lt;/em&gt; the markup I have specified, with next to nothing auto-generated by Drupal. I would recommend &lt;a href="http://www.packtpub.com/drupal-7-first-look-at-new-features/book"&gt;Drupal 7 First Look&lt;/a&gt; to anyone looking to make the transition from Drupal 6 to 7, or those simply wanting a starting point for learning more about this robust &lt;abbr title="Content Management System"&gt;&lt;span class="caps"&gt;CMS&lt;/span&gt;&lt;/abbr&gt;.&lt;/p&gt;</description>
 <pubDate>Sun, 13 Mar 2011 19:06:53 +0000</pubDate>
 <dc:creator>Nathan Smith</dc:creator>
 <guid isPermaLink="false">336 at http://sonspring.com</guid>
</item>
<item>
 <title>Joining HP</title>
 <link>http://sonspring.com/journal/joining-hp</link>
 <description>&lt;a href="/topic/personal"&gt;Personal&lt;/a&gt;	&lt;p&gt;&lt;img src="/sites/default/files/hp_sign.jpg" alt="" width="500" height="150" /&gt;&lt;/p&gt;

	&lt;p&gt;These past two years have been filled with great personal growth. From fumbling through learning how to be a father to our now 2-year old son, to working alongside some of the most talented and dedicated people I’ve ever known at &lt;a href="http://www.fellowshiptech.com/"&gt;Fellowship Technologies&lt;/a&gt;, I count myself fortunate and blessed.&lt;/p&gt;

	&lt;p&gt;Choosing to move on to another opportunity was not a decision I weighed lightly. It was a bittersweet send-off lunch this past December 22nd, saying goodbye to friends and coworkers. That said, I am also excited for the new challenges that await. I will be a UX Developer at &lt;a href="http://www.hp.com/"&gt;HP&lt;/a&gt; — starting Tuesday, January 4th.&lt;/p&gt;

	&lt;p&gt;It all came about unexpectedly, with a hypothetical “Want to work for HP?” question posed to me by fellow designer / developer &lt;a href="http://wynnnetherland.com/"&gt;Wynn Netherland&lt;/a&gt;, whom I know from being a guest on his &lt;a href="http://thechangelog.com/post/980148470/episode-0-3-2-960-gs-with-nathan-smith"&gt;podcast&lt;/a&gt; and through local &lt;a href="http://dallasrb.org/"&gt;Ruby&lt;/a&gt; meet-ups. Initially, I was poised to give the typical recruiter response: “Happy where I’m at, thanks” — but I figured I ought to at least hear him out, lest I snub a friend.&lt;/p&gt;

	&lt;p&gt;The more he told me, the more interesting it sounded: Doing heavy JavaScript work as a front-end developer on a &lt;a href="http://rubyonrails.org/"&gt;Rails&lt;/a&gt; team, with occasional travel and in-office meetings, but for the most part a work-from-home gig. Technology and remote work environment aside, the premise sounded pretty darn cool, too.&lt;/p&gt;

	&lt;p&gt;Basically, the customers of the apps we’ll be building are “ourselves” so to speak, creating tools for other developers to manage their usage of HP’s forthcoming cloud computing service. From what I gather, this &lt;a href="http://en.wikipedia.org/wiki/Intrapreneurship"&gt;intrapreneurial&lt;/a&gt; venture is being incubated as part of &lt;a href="http://www.hpl.hp.com/"&gt;HP Labs&lt;/a&gt;, to eventually become a full product offering.&lt;/p&gt;

	&lt;p&gt;Ultimately, to borrow a phrase from &lt;a href="http://en.wikipedia.org/wiki/The_Godfather"&gt;The Godfather&lt;/a&gt; — I was presented with an offer that I couldn’t refuse. I will probably post about the job from time to time as I get more accustomed to it, but I figured I ought to blog about it here to make it “official” since several people have been asking me about my updated LinkedIn &lt;a href="http://www.linkedin.com/in/nathan"&gt;profile&lt;/a&gt;, and why friends were saying &lt;a href="http://twitter.com/JesseDearing/status/17636930921435136"&gt;goodbye&lt;/a&gt; to me on Twitter.&lt;/p&gt;</description>
 <pubDate>Mon, 03 Jan 2011 05:17:51 +0000</pubDate>
 <dc:creator>Nathan Smith</dc:creator>
 <guid isPermaLink="false">334 at http://sonspring.com</guid>
</item>
<item>
 <title>Formalize CSS</title>
 <link>http://sonspring.com/journal/formalize-css</link>
 <description>&lt;a href="/topic/css"&gt;CSS&lt;/a&gt;	&lt;p class="notice"&gt;&lt;a href="http://formalize.me/"&gt;Formalize &lt;span class="caps"&gt;CSS&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://formalize.me/demo.html"&gt;View demo&lt;/a&gt; | &lt;a href="http://github.com/nathansmith/formalize/zipball/master"&gt;Download&lt;/a&gt; | &lt;a href="http://github.com/nathansmith/formalize/"&gt;GitHub repo&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;&lt;img src="/sites/default/files/formalize_cropped.png" title="Formalize CSS" alt="Formalize CSS" width="500" height="300" /&gt;&lt;br /&gt;&lt;small class="mute"&gt;Formalize &lt;span class="caps"&gt;CSS&lt;/span&gt; — Dress up your forms!&lt;/small&gt;&lt;/p&gt;

&lt;hr /&gt;&lt;h2&gt;Intro&lt;/h2&gt;

	&lt;p&gt;As designers, we are used to having quite a bit of control over how things are displayed in a browser. Sure, differing rendering engines don’t always agree on everything, but for the most part we can at least find ways to mitigate variance through workarounds, or by writing for the lowest common denominator.&lt;/p&gt;

	&lt;p&gt;By far, one of the most frustrating parts of dealing with browser inconsistencies has &lt;em&gt;got&lt;/em&gt; to be forms. There are two distinctively differing schools of thought regarding (not) styling form elements. For the longest time, we’ve had people on both sides of the proverbial fence, neither group being particularly pragmatic.&lt;/p&gt;

	&lt;p&gt;Some designers advocate styling form elements to match the brand of a site. Others would tell you to leave them alone entirely, so that they adhere to the native look and feel of a given operating system.&lt;/p&gt;

	&lt;p&gt;That’s all well and good, except most browsers don’t mesh completely when it comes to OS consistency. Some browsers use a monospace font for &lt;code&gt;textarea&lt;/code&gt;, and OS X neglects to style the border of &lt;code&gt;textarea&lt;/code&gt; the same as text &lt;code&gt;input&lt;/code&gt; elements. So what’s a designer to do? It’s a conundrum, for sure.&lt;/p&gt;

	&lt;p&gt;I would say that I fall somewhere in the middle of the two camps.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;My Solution&lt;/h2&gt;

	&lt;p&gt;I want some measure of control over form elements, without changing them so drastically as to appear foreign in a user’s operating system. Thus, my quest to find a happy medium, where browsers would generally agree and let me keep my sanity. The result is what I’m simply referring to as &lt;a href="http://formalize.me/"&gt;Formalize &lt;span class="caps"&gt;CSS&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;I’ve attempted to bridge the gap between various browsers and OS’s, taking the best ideas from each, and implementing what is possible across the board. For the most part, this means most textual form elements have a slight inset, and all buttons look consistent, including the &lt;code&gt;button&lt;/code&gt; tag.&lt;/p&gt;

	&lt;p&gt;I have also added a few niceties. All browsers that support &lt;code&gt;box-shadow&lt;/code&gt; — even those on Windows and Linux — now have a light blue &lt;code&gt;:focus&lt;/code&gt; border, ala OS X. Also, via &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; I’ve added support for the HTML5 &lt;code&gt;placeholder&lt;/code&gt; and &lt;code&gt;autofocus&lt;/code&gt; attributes, for browsers that don’t yet handle it natively.&lt;/p&gt;

	&lt;p&gt;I’ve left untouched the input types of &lt;code&gt;range&lt;/code&gt; and &lt;code&gt;file&lt;/code&gt;. As far as I’m concerned, they are the pariahs of form elements — inconsistent and stubbornly resistant to styling. For those browsers that &lt;em&gt;do&lt;/em&gt; actually support &lt;code&gt;range&lt;/code&gt;, it’s a slider, but for those that don’t, it’s a text box. I’ve left it alone, with the assumption that when all browsers eventually handle &lt;code&gt;range&lt;/code&gt;, they’ll do so as some sort of slider.&lt;/p&gt;

	&lt;h3&gt;Make it Yours&lt;/h3&gt;

	&lt;p&gt;Note: In the &lt;a href="http://formalize.me/demo.html"&gt;demo&lt;/a&gt; pages, I have not applied any widths, so that you can see how browsers would natively handle the various form elements. For instance, &lt;a href="http://opera.com/"&gt;Opera&lt;/a&gt; styles some elements (url, email, datetime, datetime-local) considerably wider than others, a quirk I’ve not seen in any other browsers.&lt;/p&gt;

	&lt;p&gt;I have included utility helper classes at the top of the &lt;em&gt;formalize.css&lt;/em&gt; file, which can be sprinkled in to add set widths to the &lt;code&gt;input&lt;/code&gt; and/or &lt;code&gt;select&lt;/code&gt; tags, such as: input_tiny, input_small, input_medium, input_large, and input_full (100% width). Feel free to change these, or delete them entirely. They’re simply meant to be suggestions, to show how you can resize elements if need be.&lt;/p&gt;

	&lt;p&gt;Unlike a framework such as the &lt;a href="http://960.gs/"&gt;960 Grid System&lt;/a&gt; — which is intended to be written against, but not altered — in general, Formalize exists just to offer some guidance as to how you might approach form styling. Nothing is set in stone. If you want to adapt it to more uniquely suit your needs, go right ahead.&lt;/p&gt;

	&lt;h3&gt;WebKit&lt;/h3&gt;

	&lt;p&gt;&lt;img src="/sites/default/files/formalize_select.png" title="WebKit Select" alt="WebKit Select" width="500" height="60" /&gt;&lt;/p&gt;

	&lt;p&gt;I debated whether to leave &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; alone, since I rather like how it looks in WebKit (Safari + Chrome) on OS X. However, since it’s the “odd man out” so to speak, I went ahead and styled it to look consistent across all browsers. For what it’s worth, this is how it would’ve looked in Safari on Windows anyway.&lt;/p&gt;

	&lt;p&gt;&lt;img src="/sites/default/files/formalize_search.png" title="WebKit Search" alt="WebKit Search" width="500" height="60" /&gt;&lt;/p&gt;

	&lt;p&gt;I’ve managed to wrangle the &lt;code&gt;search&lt;/code&gt; input under control in WebKit. This means that Safari and Chrome will render &lt;code&gt;search&lt;/code&gt; the same as a &lt;code&gt;text&lt;/code&gt; input, but you still get a recent search list, and clear/reset [x] functionality. In case you’re curious, these magic lines of &lt;span class="caps"&gt;CSS&lt;/span&gt; undo WebKit’s native rounded styling:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;input[type="search"] {
  -webkit-appearance: none;
}
&lt;/code&gt;
&lt;code&gt;input[type="search"]::-webkit-search-decoration {
  display: none;
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;IE6 &amp;amp; IE7&lt;/h3&gt;

	&lt;p&gt;I even went so far as to add extra classes via JavaScript as styling hooks for IE6, since it doesn’t recognize attribute selectors like &lt;code&gt;input[type=text]&lt;/code&gt;. Oddly enough, this involved duplicating styles, rather than stacking IE6 class names, because the presence of an attribute selector in a comma separated list of elements will cause IE6 to ignore the style rules completely. For example…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;.ie6_button {
  /* This works in IE6. */
}
&lt;/code&gt;
&lt;code&gt;.ie6_button,
input[type="submit"] {
  /* This doesn't work. */
}
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Needless to say, if you do not need to support IE6 (hooray), feel free to delete the entire section in &lt;em&gt;formalize.css&lt;/em&gt; that pertains to it, because all those styles are duplicated just for that one browser. Really, you ought to drop IE6 anyway.&lt;/p&gt;

	&lt;p&gt;Additionally, IE6 and IE7 have faux &lt;code&gt;box-sizing&lt;/code&gt; support added for &lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt; and &lt;code&gt;class="input_full"&lt;/code&gt;, so they can go to 100% width, and still have border and side padding applied. You can read more about &lt;code&gt;box-sizing&lt;/code&gt; at &lt;a href="http://css-tricks.com/box-sizing/"&gt;&lt;span class="caps"&gt;CSS&lt;/span&gt; Tricks&lt;/a&gt;.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;Thanks&lt;/h2&gt;

	&lt;p&gt;Several people helped me make Formalize what it is. Namely, &lt;a href="http://anthonyshort.com.au/"&gt;Anthony Short&lt;/a&gt; for pointing out that &lt;code&gt;search&lt;/code&gt; is indeed conquerable in WebKit, and &lt;a href="http://css-tricks.com/"&gt;Chris Coyier&lt;/a&gt; for a tip on how to style the color of &lt;code&gt;placeholder&lt;/code&gt; text. Additionally, thanks to &lt;a href="http://snook.ca/"&gt;Jonathan Snook&lt;/a&gt; for taking a screenshot in IE6 on Windows XP for me (just to double check &lt;a href="http://www.my-debugbar.com/wiki/IETester/HomePage"&gt;&lt;span class="caps"&gt;IET&lt;/span&gt;ester&lt;/a&gt;), and to &lt;a href="http://john.do/"&gt;John Saddington&lt;/a&gt; for snapping a shot on his iPhone 4.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;Screenshots&lt;/h2&gt;

	&lt;p class="notice"&gt;Note: Formalize’s buttons differ slightly from these screenshots (now less round).&lt;/p&gt;

	&lt;p&gt;If you’re curious how things look in various browsers and operating systems, check out the attached screenshots. I have to say that while &lt;a href="http://opera.com/"&gt;Opera&lt;/a&gt; takes the cake as far as raw functionality, it also sports the ugliest looking styles for some of the newer HTML5 form elements, the worst offender being &lt;code&gt;datetime&lt;/code&gt;.&lt;/p&gt;

	&lt;ul&gt;&lt;li&gt;&lt;a href="/sites/default/files/formalize_android.png"&gt;formalize_android.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_ios.png"&gt;formalize_ios.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_mac_chrome.png"&gt;formalize_mac_chrome.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_mac_firefox.png"&gt;formalize_mac_firefox.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_mac_opera.png"&gt;formalize_mac_opera.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_mac_safari.png"&gt;formalize_mac_safari.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_palm_webos.png"&gt;formalize_palm_webos.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_ubuntu_chrome.png"&gt;formalize_ubuntu_chrome.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_ubuntu_firefox.png"&gt;formalize_ubuntu_firefox.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_win_chrome.png"&gt;formalize_win_chrome.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_win_firefox.png"&gt;formalize_win_firefox.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_win_ie6_tester.png"&gt;formalize_win_ie6_tester.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_win_ie6.png"&gt;formalize_win_ie6.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_win_ie7.png"&gt;formalize_win_ie7.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_win_ie8.png"&gt;formalize_win_ie8.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_win_ie9.png"&gt;formalize_win_ie9.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_win_opera.png"&gt;formalize_win_opera.png&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/sites/default/files/formalize_win_safari.png"&gt;formalize_win_safari.png&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;</description>
 <pubDate>Sat, 16 Oct 2010 19:30:01 +0000</pubDate>
 <dc:creator>Nathan Smith</dc:creator>
 <guid isPermaLink="false">333 at http://sonspring.com</guid>
</item>
<item>
 <title>Why Drupal?</title>
 <link>http://sonspring.com/journal/why-drupal</link>
 <description>&lt;a href="/topic/content-management"&gt;Content Management&lt;/a&gt;	&lt;p&gt;Lately I’ve been asked in several different ways what essentially boils down to one question: “Why Drupal?” The subtext of the question is: “Why not some other system such as [insert your favorite &lt;span class="caps"&gt;CMS&lt;/span&gt; here]?” Allow me to explain…&lt;/p&gt;

	&lt;h2&gt;Background&lt;/h2&gt;

	&lt;p&gt;If you are familiar with the history of my site, you’ll know that &lt;em&gt;once upon a time&lt;/em&gt; it ran on &lt;a href="http://textpattern.com"&gt;Textpattern&lt;/a&gt;, a designer friendly content management system that sports a templating system akin to the syntax of &lt;span class="caps"&gt;XHTML&lt;/span&gt;. I was so enamored with &lt;abbr title="Textpattern"&gt;&lt;span class="caps"&gt;TXP&lt;/span&gt;&lt;/abbr&gt;, as the cool kids call it, that I even pushed forth an effort to write a book about it. Several coauthors and I labored on what became &lt;a href="http://textpatternsolutions.com/"&gt;Textpattern Solutions&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;Again, depending on how long you’ve known me, you might also recall that last year I built a proof of concept module for the &lt;a href="http://expressionengine.com/"&gt;ExpressionEngine&lt;/a&gt; &lt;abbr title="Content Management System"&gt;&lt;span class="caps"&gt;CMS&lt;/span&gt;&lt;/abbr&gt; to consume the Fellowship One  &lt;a href="http://developer.fellowshipone.com/index.php/docs/"&gt;&lt;span class="caps"&gt;API&lt;/span&gt;&lt;/a&gt;. I even took the time to make a brief &lt;a href="/journal/f1-ee-module"&gt;screencast&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;Like many designers, I was impressed with the EE 2.0 admin interface demo’d at the &lt;a href="http://sxsw.com/"&gt;&lt;span class="caps"&gt;SXSW&lt;/span&gt;&lt;/a&gt; conference a few years ago. At the time, the &lt;em&gt;core&lt;/em&gt; version of EE was free for nonprofits. It seemed like a good system to encourage for church use. We even chose EE to power our Fellowship Tech &lt;a href="http://developer.fellowshipone.com/"&gt;Developer&lt;/a&gt; site.&lt;/p&gt;

	&lt;p&gt;Ironically, after presenting my EE module talk at the &lt;a href="http://dynamicchurchconference.com/"&gt;Dynamic Church Conference&lt;/a&gt; in 2009, the first responses were basically “What about Drupal?” As it turns out, many of our church customers are big proponents of open source.&lt;/p&gt;

	&lt;p&gt;At the time, I knew next to nothing about &lt;a href="http://drupal.org/"&gt;Drupal&lt;/a&gt;, but this spurred my curiosity. I knew that it could power large sites, and that the &lt;a href="http://geeksandgod.com/"&gt;Geeks &amp;amp; God&lt;/a&gt; podcast guys loved it, but I didn’t really know much more than that. Coincidentally, 2009 was when interest began to pick up in the Drupal community around using &lt;a href="http://960.gs/"&gt;960.gs&lt;/a&gt; as a base for building themes. I was encouraged by &lt;a href="http://mattfarina.com/"&gt;Matt Farina&lt;/a&gt; to speak at the first ever &lt;a href="http://design4drupal.org/"&gt;Design 4 Drupal&lt;/a&gt; event in Boston, hosted by &lt;a href="http://mit.edu/"&gt;&lt;span class="caps"&gt;MIT&lt;/span&gt;&lt;/a&gt;. I ended up co-presenting with Todd Neinkerk of the Austin based agency &lt;a href="http://fourkitchens.com/"&gt;Four Kitchens&lt;/a&gt; – &lt;a href="http://www.youtube.com/watch?v=kYHzUK0jcUM"&gt;video here&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;It was there at the &lt;span class="caps"&gt;MIT&lt;/span&gt; &lt;a href="http://en.wikipedia.org/wiki/Stata_Center"&gt;Stata Center&lt;/a&gt; that I was immersed in the culture of Drupal for three days, and I began to see what all the fuss was about. The designers and developers I met were highly collaborative, eager to both teach and learn.&lt;/p&gt;

	&lt;p&gt;It should be noted that I have also attended a &lt;a href="http://typo3.org/"&gt;TYPO3&lt;/a&gt; conference in Dallas, and found it to have a unique culture all its own. My friend &lt;a href="http://busynoggin.com/"&gt;Ron Hall&lt;/a&gt; is a huge fan of TYPO3, and helps to organize their North American conference. For whatever reason, TYPO3 is decidedly more popular in Europe, particularly in Germany.&lt;/p&gt;

 &lt;hr /&gt;&lt;h3&gt;Deep Dive&lt;/h3&gt;

	&lt;p&gt;I have never been the type of person to purchase things on a whim. If anything, I tend to research products to a fault, spending weeks or months reading up on a particular topic. If memory serves, I have read four books on Drupal, three on EE and/or &lt;a href="http://codeigniter.com/"&gt;CodeIgniter&lt;/a&gt;, and two on TYPO3. Those books are…&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Drupal&lt;/strong&gt;&lt;/p&gt;

	&lt;ul&gt;&lt;li&gt;&lt;a href="https://www.packtpub.com/drupal-6-themes/book"&gt;Drupal 6 Themes&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="https://www.packtpub.com/drupal/book"&gt;Drupal: Creating Blogs, Forums, Portals, and Community Websites&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.drupalbook.com/"&gt;Pro Drupal Development&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://usingdrupal.com/"&gt;Using Drupal&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;ExpressionEngine&lt;/strong&gt;&lt;/p&gt;

	&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.train-ee.com/courseware/books/detail/building-an-expressionengine-site-small-business/"&gt;Building an ExpressionEngine Site – Small Business&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="https://www.packtpub.com/building-websites-with-expressionengine-1.6/book"&gt;Building Websites with ExpressionEngine&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="https://www.packtpub.com/codeigniter-php-application-development-mvc/book"&gt;CodeIgniter for Rapid &lt;span class="caps"&gt;PHP&lt;/span&gt; Application Development&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;TYPO3&lt;/strong&gt;&lt;/p&gt;

	&lt;ul&gt;&lt;li&gt;&lt;a href="https://www.packtpub.com/master-typoscript-typo3/book"&gt;Mastering TypoScript: TYPO3 Website, Template, and Extension Development&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="https://www.packtpub.com/typo3/book"&gt;TYPO3: Enterprise Content Management&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;&lt;p&gt;&lt;em&gt;Bonus:&lt;/em&gt; I also have on my bookshelf &lt;a href="http://www.apress.com/9781430219361"&gt;The Definitive Guide to Django&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;Okay, maybe I am the type of person who purchases &lt;em&gt;books&lt;/em&gt; on a whim!&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;Why Change?&lt;/h2&gt;

	&lt;p&gt;&lt;strong&gt;Textpattern&lt;/strong&gt;&lt;/p&gt;

	&lt;p&gt;So anyway, believe me when I say I like to have an informed opinion. The big question is: What made me leave Textpattern, after pouring in so many hours learning the system, and even more writing a book? I can say with all honesty, it was a “It’s not you, it’s me” situation. At some point, I realized that I had sort of tapped out the upper limits of what I knew how to build with Textpattern.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;ExpressionEngine&lt;/strong&gt;&lt;/p&gt;

	&lt;p&gt;So I began looking elsewhere. First I checked out EE, learning the ins and outs of how it handles layouts and modules. The way it works is not unlike how &lt;span class="caps"&gt;TXP&lt;/span&gt; does templates. I was intrigued by that possibility, coupled with things like their 1st party developed forum and member management modules.&lt;/p&gt;

	&lt;p&gt;But as we fleshed out the FT Developer site, I realized these modules (in 1.6.x) did not work like the rest of the system. Instead, it involved hacking away at &lt;a href="http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc"&gt;heredoc&lt;/a&gt; strings. Elegance lost, if one was to build sites beyond what &lt;span class="caps"&gt;TXP&lt;/span&gt; could handle. Also, EE sent down headers to the browser before module code was output.&lt;/p&gt;

	&lt;p&gt;This meant we had a heck of a time getting &lt;a href="http://oauth.net/"&gt;OAuth&lt;/a&gt; to work. This is why no further development was done on our proof of concept EE module. That, and the change in EE 2.0’s licensing that does not allow for nonprofit usage free of charge.&lt;/p&gt;

	&lt;p&gt;Again, none of this is a fault of the &lt;span class="caps"&gt;CMS&lt;/span&gt;. EE is fine for what it’s meant to do.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;TYPO3&lt;/strong&gt;&lt;/p&gt;

	&lt;p&gt;Unlike &lt;span class="caps"&gt;TXP&lt;/span&gt; or EE, &lt;a href="http://typo3.org/"&gt;TYPO3&lt;/a&gt; really shines as an application development platform and &lt;span class="caps"&gt;CMS&lt;/span&gt; hybrid. But it can be somewhat daunting just to get installed and configured correctly. Thankfully, there are efforts like the &lt;a href="http://webempoweredchurch.org/"&gt;Web Empowered Church&lt;/a&gt; project helping to ease the learning curve, by providing users with guidance and starter templates. For me, what scared me off about TYPO3 was having to learn yet another pseudo syntax after having learned EE and &lt;span class="caps"&gt;TXP&lt;/span&gt;’s respective tags.&lt;/p&gt;

	&lt;p&gt;I came across this article…&lt;/p&gt;

	&lt;p&gt;— &lt;a href="http://www.typo3wizard.com/en/snippets/cool-stuff-typoscript/copyright-notice-with-current-year.html"&gt;TYPO3 Wizard: Copyright Notice with Current Year&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;I remembered thinking: That’s a &lt;em&gt;lot&lt;/em&gt; of steps. In &lt;span class="caps"&gt;PHP&lt;/span&gt;, it’s just one line…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?= date('Y') ?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;It’s ironic that I was initially drawn to Textpattern because of it’s pseudo syntax, and because &lt;span class="caps"&gt;PHP&lt;/span&gt; seemed intimidating. Now I feel like an old man who can’t be bothered to learn a faux language, preferring instead to write straight &lt;span class="caps"&gt;PHP&lt;/span&gt;.&lt;/p&gt;

	&lt;p&gt;At this point in my career, investing time to learn something that only works within the confines of a particular &lt;span class="caps"&gt;CMS&lt;/span&gt; could be likened to learning &lt;a href="http://en.wikipedia.org/wiki/Klingon"&gt;Klingon&lt;/a&gt;. Yes, technically it’s a language. Yes, there are extremely &lt;a href="http://www.kli.org/"&gt;zealous&lt;/a&gt; groups of people that are fluent in it. But outside of that “universe,” all that knowledge is no longer applicable. It’s tantamount to memorizing answers in &lt;a href="http://en.wikipedia.org/wiki/Trivial_Pursuit"&gt;Trivial Pursuit&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;Learning &lt;span class="caps"&gt;PHP&lt;/span&gt; is like learning Spanish. Or English. Or some widely spoken language that will benefit you in more than just niche circles. &lt;span class="caps"&gt;PHP&lt;/span&gt; on the web is like white paint. It’s everywhere. It might not be as pretty as &lt;a href="http://ruby-lang.org/"&gt;Ruby&lt;/a&gt; or as puristic as &lt;a href="http://python.org/"&gt;Python&lt;/a&gt;, but as a developer it is worth having at least a working knowledge of &lt;span class="caps"&gt;PHP&lt;/span&gt;.&lt;/p&gt;

	&lt;p&gt;Even 37signals, creators of &lt;a href="http://rubyonrails.org/"&gt;Rails&lt;/a&gt;, used &lt;span class="caps"&gt;PHP&lt;/span&gt; for their book &lt;a href="http://gettingreal.37signals.com/toc.php"&gt;Getting Real&lt;/a&gt;.&lt;/p&gt;

 &lt;hr /&gt;&lt;h3&gt;What about WP?&lt;/h3&gt;

	&lt;p&gt;I see this old debate flare up from time to time. Some say…&lt;/p&gt;

	&lt;p&gt;“WordPress is not a &lt;span class="caps"&gt;CMS&lt;/span&gt;. It’s just a blogging tool.”&lt;/p&gt;

	&lt;p&gt;Others rebut…&lt;/p&gt;

	&lt;p&gt;“Blog posts are content. WP manages blog posts. Ergo, it’s a &lt;span class="caps"&gt;CMS&lt;/span&gt;.”&lt;/p&gt;

	&lt;p&gt;Well, call it whatever you want but &lt;a href="http://wordpress.org/"&gt;WordPress&lt;/a&gt; is not for me. Yes I know that it’s wildly popular. A quick comparison on &lt;a href="http://www.google.com/trends?q=wordpress,+drupal"&gt;Google Trends&lt;/a&gt; shows that the number of searches for &lt;em&gt;WordPress&lt;/em&gt; easily outnumber those for &lt;em&gt;Drupal&lt;/em&gt; related topics, by a staggering 10-to-3 ratio. So then, &lt;em&gt;why not&lt;/em&gt; WordPress? Am I leaving money on the table by not listing WP theme development in my repertoire? Yes and no.&lt;/p&gt;

	&lt;p&gt;&lt;a href="http://www.google.com/trends?q=wordpress,+drupal"&gt;&lt;img src="/sites/default/files/trends_wp_drupal.gif" title="WordPress vs. Drupal" alt="WordPress vs. Drupal" width="500" height="225" /&gt;&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;Commercial blog theme design is a saturated market for good reason. It’s not terribly difficult. In fact, I’d venture to say if I were in that line of work, I’d find it downright monotonous. While there is no limit to the level of visual detail one can incorporate into a blog design, the functionality only goes so far.&lt;/p&gt;

	&lt;p&gt;Blogging goes like this: Write a post. Upload a photo. Maybe a video. Or do a podcast. Let people comment on any or all of these content entries. Rinse, repeat. As designers, we’ve have become quite adept at cranking out themes to accomodate these basic user behaviors. This is where WordPress excels.&lt;/p&gt;

	&lt;p&gt;In fact, WP is so tailored to blogging that I liken it to a yacht. It is streamlined for that particular task. It allows people with varying levels of technical savvy to get a site installed and online posthaste. Or, via &lt;a href="http://wordpress.com/"&gt;WordPress.com&lt;/a&gt; you can skip the install process altogether and opt for a hosted blog. While a sharp focus on blogging ensures that the famed “5 minute install” will continue to be a selling point, it also means that WP at its core isn’t meant for big sites.&lt;/p&gt;

	&lt;p&gt;Note: I mean “big” from an &lt;a href="http://en.wikipedia.org/wiki/Information_architecture"&gt;information architecture&lt;/a&gt; standpoint. I realize that with proper caching plugins and a good hosting setup WP can power sites with tons of traffic and an abundance of blog posts. While that’s all well and good, I’m interested in building sites and/or web applications that have both breadth and depth.&lt;/p&gt;

	&lt;p&gt;Continuing with the WP as yacht analogy, I’d say Drupal is an aircraft carrier. A ship that big can carry fighters, bombers, supplies, or even refugees in a humanitarian relief effort. What I see far too often is people trying to strap things onto their yachts and then wondering why they run into difficulties. Custom fields do not make for an ideal &lt;span class="caps"&gt;CMS&lt;/span&gt; workflow. I learned this with Textpattern.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;Scope&lt;/h2&gt;

	&lt;p&gt;At it’s core, Drupal is built for scalability. You can use it like I am on this site: humble blog, about section with sub-sections, portfolio, contact page, etc. It is also versatile enough to power sites like: &lt;a href="http://www.commerce.gov/"&gt;Department of Commerce&lt;/a&gt;, &lt;a href="http://duke.edu/"&gt;Duke University&lt;/a&gt;, &lt;a href="http://economist.com/"&gt;The Economist&lt;/a&gt;, &lt;a href="http://www.fastcompany.com/"&gt;Fast Company&lt;/a&gt;, &lt;a href="http://www.unglobalpulse.org/"&gt;UN Global Pulse&lt;/a&gt;, and &lt;a href="http://www.whitehouse.gov/"&gt;The White House&lt;/a&gt;.&lt;/p&gt;

	&lt;p&gt;An extensive list of high profile &lt;a href="http://buytaert.net/tag/drupal-sites"&gt;Drupal sites&lt;/a&gt; is maintained by Dries Buytaert, creator of Drupal. While I’m on the topic: Dries is an extremely smart guy. He holds bachelor, master, and doctoral degrees in computer science. He cofounded &lt;a href="http://acquia.com/"&gt;Acquia&lt;/a&gt;, which focuses on providing enterprise level infrastructure and support for large Drupal sites. They are for Drupal what &lt;a href="http://en.wikipedia.org/wiki/Red_Hat"&gt;Red Hat&lt;/a&gt; is to Linux.&lt;/p&gt;

	&lt;p&gt;My reasoning for learning Drupal, when &lt;span class="caps"&gt;TXP&lt;/span&gt; was meeting the needs of my former site just fine, is that I want to constantly be pushing myself to learn more, and to increase the capacity of what I am able to build. I’m not one to seek out complexity just for kicks, like some &lt;a href="http://www.uxmag.com/design/the-impossible-bloomberg-makeover"&gt;Bloomberg&lt;/a&gt; pundit. I do enjoy taking something that otherwise might be complex, and breaking it down into digestible pieces.&lt;/p&gt;

	&lt;p&gt;Or, as the saying goes…&lt;/p&gt;

	&lt;blockquote&gt;
		&lt;p&gt;Q: How do you eat an elephant?&lt;br /&gt;
A: One bite at a time!&lt;/p&gt;
	&lt;/blockquote&gt;

	&lt;p&gt;This is something Drupal allows me to do: Create hierarchical structures of content, helping to organize things so that users are able to find them presented logically. Though I know I’m not using it to its fullest on my simple site, I have peace of mind knowing that I’ve invested time in a system that can grow with a client’s needs. I can say with impunity: “Yeah, Drupal can do that.”&lt;/p&gt;

	&lt;p&gt;I think the ability to handle large scale websites is why you see Drupal agencies that employ anywhere from a handful to several dozen people, whereas people who build custom or commercial blog templates usually operate in smaller groups or as independent freelancers. The size of site dictates the manpower.&lt;/p&gt;

	&lt;p&gt;I keep an eye on these powerhouse Drupal agencies…&lt;/p&gt;

	&lt;ul&gt;&lt;li&gt;&lt;a href="http://atendesigngroup.com/"&gt;Aten Design Group&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://chapterthree.com/"&gt;Chapter Three&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://developmentseed.org/"&gt;Development Seed&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://fourkitchens.com/"&gt;Four Kitchens&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://lullabot.com/"&gt;Lullabot&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://markboultondesign.co.uk/"&gt;Mark Boulton Design&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://palantir.net/"&gt;Palantir&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://workhabit.com/"&gt;Work Habit&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;&lt;p&gt;I am consistently impressed to see Development Seed building robust applications such as &lt;a href="http://managingnews.com/"&gt;Managing News&lt;/a&gt;, &lt;a href="http://mapbox.com/"&gt;MapBox&lt;/a&gt;, and &lt;a href="http://openatrium.com/"&gt;Open Atrium&lt;/a&gt; atop Drupal. I also listen semi regularly to the Lullabot &lt;a href="http://www.lullabot.com/ideas/podcasts"&gt;podcast&lt;/a&gt; hosted by founder &lt;a href="http://www.lullabot.com/about/team/jeff-robbins"&gt;Jeff Robbins&lt;/a&gt;, sometimes referred to as the “voice of Drupal” in the community. Lullabot was one of the first agencies to offer Drupal training, even before it was in vogue. They also have an extensive library of instructional &lt;a href="http://store.lullabot.com/"&gt;videos&lt;/a&gt; covering a variety of Drupal topics.&lt;/p&gt;

 &lt;hr /&gt;&lt;h2&gt;So What?&lt;/h2&gt;

	&lt;p&gt;What am I trying to convince you of? Nothing really. I just figured that since I am asked &lt;em&gt;Why Drupal&lt;/em&gt; with increasing frequency, I should probably record my thoughts. If I’ve convinced you to try &lt;a href="http://drupal.org/"&gt;Drupal&lt;/a&gt;, great. If not, that’s fine too.&lt;/p&gt;

	&lt;p&gt;I used to feel a burden for my designer friends when I’d see them spinning their wheels, making yet another blog theme, for yet another client that wanted his/her blog to be the coolest thing ever. I would wonder about such friends: “Why do they paint themselves into a corner, just using a blogging tool? Don’t they know it won’t scale well as a &lt;span class="caps"&gt;CMS&lt;/span&gt;?” As I’ve grown older, and arguably wiser, I’ve learned not to worry about such things. Some people &lt;em&gt;want&lt;/em&gt; to build blogs, and can make a decent living doing so. More power to ‘em.&lt;/p&gt;

	&lt;p&gt;Personally, I find myself yearning for more than re-skinning the same functionality. That’s partly why I love working for a company that builds web applications. I want to solve complex problems with simple solutions. When I do build sites, I want a &lt;span class="caps"&gt;CMS&lt;/span&gt; that meshes with my philosophy. For me, that means &lt;a href="http://drupal.org/"&gt;Drupal&lt;/a&gt;.&lt;/p&gt;</description>
 <pubDate>Thu, 05 Aug 2010 07:15:11 +0000</pubDate>
 <dc:creator>Nathan Smith</dc:creator>
 <guid isPermaLink="false">330 at http://sonspring.com</guid>
</item>
</channel>
</rss>
