jade(pug)
因为商标版权问题,jade已经更名为Pug。
Pug 是一个高性能的模板引擎,它是用 JavaScript 实现的,而且能够供 Node 使用,固然还支持其余语言。html
文件后缀名为.pug(.jade)html5
npm安装 建议安装个nrm来进行源管理npm
npm install pug -g npm install pug-cli -g
为了方便编写代码,最好把编译器的tab设置:2.缓存
// index.jade doctype html html head title jade test body h2 jade study
粗暴的编译方法安全
// index.html <!DOCTYPE html><html><head><title>jade test</title></head><body><h2>jade study </h2></body></html>
发现编译后的代码不具有可读性工具
pug -- help Options: -P, --pretty compile pretty HTML output ## 输出漂亮结构的HTML -D, --no-debug compile without debugging (smaller functions) ## 不带调试的编译 -w, --watch watch files for changes and automatically re-render ## 对某个文件的变更保持监控 -E, --extension <ext> specify the output file extension ## 指定输出文件扩展名 -s, --silent do not output logs ## 不输出日志 // 从新编译 pug -P index.jade <!DOCTYPE html> <html> <head> <title>jade test</title> </head> <body> <h2>jade study </h2> </body> </html>
自动编译
只是为了学习,这里只要设置-w -P .开发中经过打包工具来进行自动编译.性能
pug pug -o . -w -P