jade2script

0.0.9 • Public • Published

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.routes("Main",true);
Main = function(options){
    var frag = document.createDocumentFragment();
    var  fc_0 = base.create('div',{"className":'main'});
    var fc_0_0 = new view.HelloWorld();
    fc_0.append(fc_0_0.fragment);
    frag.appendChild(fc_0);
    this.fragment = frag;
    return frag;
};
 
base.routes("view.HelloWorld",true);
view.HelloWorld = function(options){
    var frag = document.createDocumentFragment();
    var  fc_0 = base.create('span',{"className":'hello'});
    fc_0.html('helloWorld!');
    frag.appendChild(fc_0);
    this.fragment = frag;
    return frag;
};

相关构建脚本: gulpfile.js tools/build.js

实现参照

maybe you need ?

License

The MIT License (MIT), read LICENSE for more information

Readme

Keywords

Package Sidebar

Install

npm i jade2script

Weekly Downloads

2

Version

0.0.9

License

MIT

Last publish

Collaborators

  • zhengzk