Zen Coding using VS.NET 2012 Extensions – Web Essentials

In the process of my wonderful journey with VS.NET 2012 , I just found a very interesting and handy feature called ‘Zen Coding’ which really going to be a cool news for every web developer.

Here is what it can able to do ,Zen coding is way to write a faster HTML using a CSS style selector syntax and in fact it helps your live simple during the time if you define CSS for a website. You have to download and install Web Essentials from the below link http://visualstudiogallery.msdn.microsoft.com/175f4e5a-bcc4-4931-b3e6-164cb1e60277

Thanks to Mads Kristensen and his team at Microsoft for adding Zen Coding to Visual Studio 2012 via Web Essentials 2012.

Below is the magic zen coding can do for you

Assume you are creating a website during a late night hours and you need a table with 15 rows along with a css class name called ‘tdBgColor’ should be assigned and have hyperlinks inside them referring to Microsoft website. Below is what all you need to do.

table>tr*15>td.tdBgColor>a[href=’http://microsoft.com’%5D

and press the tab ,right immediately you can see a html tags are created for you. like below

<table>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
<tr>
<td class=”tdBgColor”><a href=”‘http://microsoft.com'”></a></td&gt;
</tr>
</table>

In the above zen coding syntax below are the characters  used and its purpose.

> creates a child element.

* is element multiplication. This creates the same thing n number of times.

. creates a class attribute

Happy coding..will post later with other magics..till then gud night.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s