thecrumb

developer | thinker | tinkerer

Sublime Text Package of the Day: Zen Coding


Zen Coding is supported by Sublime, and I've been doing a lot more front end work lately. I'm going to try and use it to see how helpful it is during daily coding.

For a refresher on what Zen Coding does, you type a simple shorthand:

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

Which Zen Coding expands into:

<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>

That is a lot less typing! While some of the syntax can get complicated you can use Zen Coding to do very simple things:

Within a .html file type:

li*5

In Sublime hit CTRL+SPACE (TAB seems to work as well) and you will get:

<li></li>
<li></li>
<li></li>
<li></li>
<li></li>

Type (remember to his CTRL+SPACE)

div.myDivName

And get:

<div class="myDivName"></div>

Make sure to check out the extensive documentation on the Zen Coding site to learn more. And Zen Coding is available for almost all the popular editors so if you haven't moved to Sublime yet, don't panic!

Zen Coding can be found in Package Control or on Google Code.


Sublime Text Package of the Day: BracketHighlighter Sublime Text Package of the Day: Case Conversion

More like this...