jade 介绍
模板引擎是一种将静态部分 代码 与动态部分数据结合的一种机制或者技术,Pug 是 Jade 更名后的项目名,与 jade 使用一致
特点:使用缩进排列的方式 解决 嵌套,而不是使用成对的 标签
jade安装
npm install jade -g
//或者
yarn global add jade
jade常用命令
# 普通编译,会在同目录下 生成 编译后的 test.html 文件
jade test.jade
# --pretty | -P (大写) 美化 输出 的 html 使之带有缩进等
jade -P test.jade
# --out | -o <dir> 将编译后的 html 输出 到指定 文件 夹
jade -P test.jade --out ./output
# --obj | -O <path|str> 向 jade 模板中传递变量,需要传递 一个 json 或者 一个 json 文件 的路径
jade -P --obj '{testName: "this is tetsName"}' test.jade
jade -P -O ./con fig .json test.jade
# --watch | -w 监听 文件 变化, 自动 重新编译
jade -P -w test.jade
网站地址 : http://jade-lang.com/
GitHub: https://github.com/pugjs/pug
网站描述: Jade 是 一个 高 性能 的模板引擎,以 JavaScript 的形式集成在 node 和浏览器中
jade官方网站
官方网站: http://jade-lang.com/
如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did175321