Zen Coding in Visual Studio 2012
http://www.johnpapa.net/zen-coding-in-visual-studio-2012
Special thanks to Mads Kristensen and his team at Microsoft for adding Zen Coding to Visual Studio 2012 via Web Essentials 2012 (along with many other great features).
Quick Reference
Here is a quick list of the Zen Coding features that are now supported in Visual Studio 2012 via the Web Essentials 2012 plug in
- # creates an id attribute
- . creates a class attribute
- [ ] creates a custom attribute
- > creates a child element
- + creates a sibling element
- ^ climbs up
- * is element multiplication. This creates the same thing n number of times
- $ is replaced with an incremental number
- $$ is used for numbers with padding
- { } creates text in an element
- <!-- Type this -->
- ul[data-bind="foreach:customers"]>li*4>span{Caption $$}+input[type=text data-bind="value:$$"]
- <!-- Creates this -->
- <uldata-bind="foreach:customers">
- <li><span>Caption 01</span><inputtype="text"value=""data-bind="value:01"/></li>
- <li><span>Caption 02</span><inputtype="text"value=""data-bind="value:02"/></li>
- <li><span>Caption 03</span><inputtype="text"value=""data-bind="value:03"/></li>
- <li><span>Caption 04</span><inputtype="text"value=""data-bind="value:04"/></li>
- </ul>
ID and Class Attributes: # and .
- <!-- Type this -->
- div#contentRegion.address
- <!-- Creates this -->
- <divid="contentRegion"class="address"></div>
Custom Attributes: [ ]
- <!-- Type this -->
- div[title]
- <!-- Creates this -->
- <divtitle=""></div>
- <!-- Type this -->
- input[placeholder="Name" type="text"]
- <!-- Creates this -->
- <inputtype="text"value=""placeholder="Name"/>
Child Elements: >
- <!-- Type this -->
- div#menu>span.item[title]
- <!-- Creates this -->
- <divid="menu">
- <spanclass="item"title=""></span>
- </div>
Sibling Elements: +
- <!-- Type this -->
- footer>div>a+input
- <!-- Creates this -->
- <footer>
- <div>
- <ahref=""></a>
- <inputtypevalue=""/>
- </div>
- </footer>
Climbing Elements: ^
- <!-- Type this -->
- footer>div>a+input^^p
- <!-- Creates this -->
- <footer>
- <div>
- <ahref=""></a>
- <inputtypevalue=""/>
- </div>
- <p></p>
- </footer>
Multiplication: *
- <!-- Type this -->
- ul>li*4>span
- <!-- Creates this -->
- <ul>
- <li><span></span></li>
- <li><span></span></li>
- <li><span></span></li>
- <li><span></span></li>
- </ul>
Item Numbering: $
- <!-- Type this -->
- section>article.item$$*4
- <!-- Creates this -->
- <section>
- <articleclass="item01"></article>
- <articleclass="item02"></article>
- <articleclass="item03"></article>
- <articleclass="item04"></article>
- </section>
Text: } {
- <!-- Type this -->
- ul>li*4>span{Caption $$}
- <!-- Creates this -->
- <ul>
- <li><span>Caption 01</span></li>
- <li><span>Caption 02</span></li>
- <li><span>Caption 03</span></li>
- <li><span>Caption 04</span></li>
- </ul>
- <!-- Type this -->
- ul>li*4>span{Caption $$}+a{click me}
- <!-- Creates this -->
- <ul>
- <li><span>Caption 01</span><ahref="">click me</a></li>
- <li><span>Caption 02</span><ahref="">click me</a></li>
- <li><span>Caption 03</span><ahref="">click me</a></li>
- <li><span>Caption 04</span><ahref="">click me</a></li>
- </ul>
Combining Them all
- <!-- Type this -->
- section[data-bind="foreach:customers"]>div*4>input[type="text" data-bind="text:$$"]
- <!-- Creates this -->
- <sectiondata-bind="foreach:customers">
- <div>
- <inputtype="text"value=""data-bind="text:01"/>
- </div>
- <div>
- <inputtype="text"value=""data-bind="text:02"/>
- </div>
- <div>
- <inputtype="text"value=""data-bind="text:03"/>
- </div>
- <div>
- <inputtype="text"value=""data-bind="text:04"/>
- </div>
- </section>
Grouping: ( )
- <!-- Type this -->
- div>(header>div)+section>(ul>li*2>a)+footer>(div>span)
- <!-- WOULD create this (not yet supported in Web Essentials 2012)-->
- <div>
- <header>
- <div></div>
- </header>
- <section>
- <ul>
- <li><ahref=""></a></li>
- <li><ahref=""></a></li>
- </ul>
- </section>
- <footer>
- <div>
- <span></span>
- </div>
- </footer>
- </div>
Lorem Ipsum Generator
You can now generate Lorem Ipsum directly in the HTML editor. Type “lorem” and hit TAB and a 30 word Lorem Ipsum text is inserted. Type “lorem10″ and a 10 word Lorem Ipsum text is inserted.
ul>li*5>lorem3
References
- Zen Coding page
- Follow Zen C0ding on twitter
- Introduction to Zen Coding from Smashing Magazine in Nov 2009
- Web Essentials 2012 for Visual Studio 2012
Zen Coding in Visual Studio 2012的更多相关文章
- 如何在Visual Studio 2012中发布Web应用程序时自动混淆Javascript
同Java..NET实现的应用程序类似,Javascript编写的应用程序也面临一个同样的问题:源代码的保护.尽管对大多数Javascript应用公开源代码不算是很严重的问题,但是对于某些开发者来说, ...
- 在Visual Studio 2012中使用VMSDK开发领域特定语言(二)
本文为<在Visual Studio 2012中使用VMSDK开发领域特定语言>专题文章的第二部分,在这部分内容中,将以实际应用为例,介绍开发DSL的主要步骤,包括设计.定制.调试.发布以 ...
- 在Visual Studio 2012中使用VMSDK开发领域特定语言(一)
前言 本专题主要介绍在Visual Studio 2012中使用Visualization & Modeling SDK进行领域特定语言(DSL)的开发,包括两个部分的内容.在第一部分中,将对 ...
- Visual Studio 2012 trial version
Update: vs2012.5.iso http://download.microsoft.com/download/9/F/1/9F1DEA0F-97CC-4CC4-9B4D-0DB45B8261 ...
- 在Visual Studio 2012 Blue theme下使用Dark theme的文本编辑器颜色设置
Visual Studio 2012 默认提供了3种color theme: blue,light,和dark.其中dark的文本编辑器颜色设定很爽,可是整个菜单项加上一些小的窗口如Find Resu ...
- 分享10条Visual Studio 2012的开发使用技巧
使用Visual Studio 2012有一段时间了,并不是追赶潮流,而是被逼迫无可奈何.客户要求的ASP.NET MVC 4的项目,要用.NET 4.5来运行.经过一段时间的摸索,得到一点经验和体会 ...
- Visual Studio 2012 Update 4 RC 启动调试失败解决方案
以下解决办法适用于任何Visual Studio开发环境,及Windows NT 6.1以上系统. 系统:Windows 8.1 Enterprise x64 RTM 开发环境:Visual Stud ...
- SQL Server Data Tools – Business Intelligence for Visual Studio 2012安装时提示“The CPU architecture....”的解决方法
SQL Server Data Tools – Business Intelligence for Visual Studio 2012,一个很强大的工具,下载地址:http://www.micros ...
- Visual Studio 2012+jQuery-1.7.1
今天用Visual Studio 2012开发一个网站项目,在集成jqplot图表控件并进行调试的时候(使用的是MVC4框架),加载网页绘制图表的时候总是报错(提示$.jqplot.barRender ...
随机推荐
- Hama学习总结
Hama学习笔记 1. Hama定义 Hama是基于HDFS上的BSP模型实现,其执行不须要MapReduce. 例证例如以下: 在单点调试的Hama系统上,仅仅执行NameNode.Da ...
- C++实现链栈的基本操作
之前对顺序栈写了基本操作,认为有必要也动手练练栈的链表实现. 对于链栈,一般不会出现栈满的情况. 链栈头文件定义例如以下: #ifndef CSTOCK_H_ #define CSTOCK_H_ ty ...
- Amazon S3数据一致性模型
左右Amazon S3有两种类型的数据的一致性模型的: 最后,一致性和读一致性. 有下面几种行为: 1 写一个新的object,然后開始读它.直到全部的变化都传播完(副本),你才干读到它,否则就是ke ...
- uboot启动阶段修改启动参数方法及分析
作者:围补 本来启动方式这节不是什么复杂的事儿,不过想简单的说清楚明白,还真是不知道怎么组织.毕竟文字跟有声语言表达有别.但愿简单的东西别让我讲的太复杂! Arm板系统文件一般有三个——bootloa ...
- UpdatePanel Repeater内LinkButton造成页面刷新问题
本意:UpdatePanel1内嵌的Repeater1中带有LinkButton1, 将由LinkButton1触发页面的UpdatePanel2更新,而不需要更新UpdatePanel1,当然也不需 ...
- poj3140(树的dfs)
题目链接:http://poj.org/problem?id=3140 题意:给定一棵n棵节点的树,求删去某条边后两个分支的最小差异值. 分析:num[u]表示以u点为根节点的子树的总人数,那么不在该 ...
- •当对自己的技术足够自信的时候,拼的就是RP和面试技巧了(转)
前言 三月真是一个忙碌的季节,刚刚开学就需要准备各种面试和笔试(鄙视).幸运的是,在长达一个月的面试内推季之后,终于同时拿到了阿里和腾讯的offer,还是挺开心的.突而想起久未更新的博客,就冒昧学一学 ...
- 怎样在C++中获得完整的类型名称
Wrote by mutouyun. (http://darkc.at/cxx-get-the-name-of-the-given-type/) 地球人都知道C++里有一个typeid操作符能够用来获 ...
- Lichee(两) 在sun4i_crane该平台下编译
让我们先来回顾一下编译命令 $ cd workdir/lichee $ ./build.sh -p sun4i_crane -k 3.0 lichee文件夹下的build.sh #!/bin/bas ...
- hdu 3790 (最短路径问题dijkstra)
主题链接:http://acm.hdu.edu.cn/showproblem.php?pid=3790 Problem Description 给你n个点,m条无向边,每条边都有长度d和花费p,给你起 ...