0.0.9 • Published 9 years ago

jade2script v0.0.9

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

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

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago