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 ...
随机推荐
- kafka web console安装
貌似非常多小伙伴都不能成功打包,共享下之前打包的文件: http://pan.baidu.com/s/1sjkE37J ======== kafka自己竟然没有还一个Web管理界面.. 这里有个第三方 ...
- 【Android小应用】颈椎保健操Android开源项目
前段时间在知乎上回答已入 IT 行业的前辈,有哪些关于保护身体健康的知识分享给 IT 新人? ,回复了一张图片,评论里面有知友希望通过程序可以实现,我后面尝试着通过程序实现了效果,现开源出来,大家可以 ...
- Java 兑换ObjectC代码
现在非常多app发展,server我们使用Java发展,实时数据交换,与Android非常easy实现.是否xml依然是json,它可以很容易地转换成一个对象.这可以是硬IOS该程序猿.它们应根据数据 ...
- 获取Enum枚举值描述的几法方法
原文:获取Enum枚举值描述的几法方法 1.定义枚举时直接用中文 由于VS对中文支持的很不错,所以很多程序员都采用了此方案. 缺点:1.不适合多语言 2.感觉不太完美,毕竟大部分程序员大部分代码都使用 ...
- 项目中那些事|ListView中嵌套ListView问题
要在一个ListView中放入另一个ListView,也即在一个ListView的每个 item 中放入另外一个ListView.但刚开始的时候,会发现放入的子ListView会显示不完全(我这里只显 ...
- Debian7.6安装过程中遇到的问题
一 sudo命令不能用 1 使用su切换到root用户,命令: su 2 使用名:vim /etc/sudoers加入sudoer用户,命令: vim /etc/sudoers 找到root=(ALL ...
- 简单的java mail发送邮件实例
mail.jar ,commons-email-X.X.jar ,activation.jar ,log4j.jar 这四个jar,放进项目里 下载地址 http://www.oracle.com/ ...
- HDOJ 5276 YJC tricks time multimap
multimap的使用 YJC tricks time Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/262144 K ...
- 一个带动画的页面底部的TabBar的实现
有时有这样一个需求,页面底部有几个图标能够点击,假设一个screenWidth显示不下这些图标,则这一列图标最后一个是more,点击more,能够通过动画展示两列图标 这样来增加layout中: &l ...
- WPF如何获得变量异步回调函数时产生的异步回调
有这样的问题,WPF当使用异步回调,需要使用产生的异步变量中的回调函数.数据库中查询诸如异步函数来获得一DataTable.怎样传递给回调函数呢? [方案一]使用全局变量 非常easy想到的是用全局变 ...