Zen Coding

Blog
The best minds from Teradata, our partners, and customers blog about whatever takes their fancy.
Teradata Employee

First off, I am not one with anything, and I don’t think anyone would appreciate a peek inside my mind. That being said and irrelevant I wanted to do a quick post on Zen coding.

Zen coding is not new. Unfortunately, there are an infinite number of things that interest me but a finite amount of time, so I am just now getting around to using it. However, I really regret putting off learning Zen coding for this long.

I am posting this on the off chance that people actually read what I write. If I save at least one person the headache of continuing to write out HTML then it was well worth the 5 minutes it took to post this - it mattered to that star fish.

What is Zen Coding?

Zen Coding is an abbreviation engine plugin for editors that allows developers to write short expressions similar to CSS selectors that expand into HTML.

Examples

html:5

expands into:

<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>

</body>
</html>



div.foo>div.bar+div.baz

expands into:

<div class="foo">
<div class="bar"></div>
<div class="baz"></div>
</div>



div#page>div.logo+ul#navigation>li*5>a

expands into (taken from):

<div id="page">
<div class="logo"></div>
<ul id="navigation">
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
</ul>
</div>

Documentation and Editor Plugins

Happy and efficient coding: http://code.google.com/p/zen-coding/