jade2script
A jade to client javascript compiler tool / 一种利用jade模板生成客户端javascript组件的编译工具
installation
jade2script is a registered npm module. So you can install it using the following command:
npm install jade2script
推荐使用gulp 可参照demo进行编写
应用指南
该项目目前应用于Verge Video Player的组件编译
如果需要在客户端使用 需引用lib/client_base.js模块
Demo
完整实例见代码
- input: ** main.jade
.main include view/hello-world
** view\hello-world.jade
.main include view/hello-world
- output:
//base lib code base;{ var frag = document; var fc_0 = base; var fc_0_0 = ; fc_0; frag; thisfragment = frag; return frag;}; base;view{ var frag = document; var fc_0 = base; fc_0; frag; thisfragment = frag; return frag;};
相关构建脚本: gulpfile.js tools/build.js
实现参照
maybe you need ?
- json2script parse json to script
- html2script parse html to script
License
The MIT License (MIT), read LICENSE for more information