1.0.1 • Published 9 years ago

gulp-ejs-compile-amd v1.0.1

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

gulp-ejs-compile-amd

NPM version Build status Code Climate Coverage Status Dependencies devDependencies

gulp-ejs-compile-amd 此插件可以将ejs模板编译成js文件并合并生成AMD风格的模块化文件.

##DEMO

tmpl1.ejs

<h1><%=title%></h1>

tmpl2.ejs

<div><%=name%></div>

result:

var tmpl = {
"tmpl1": function (data) {
var __p=[],_p=function(s){__p.push(s)};
;_p('<h1>');
;_p(__e(title));
;_p('</h1>\r\n\
');
return __p.join("");
},
"tmpl2": function (data) {
var __p=[],_p=function(s){__p.push(s)};
;_p('<div>');
;_p(__e(name));
;_p('</div>\r\n\
');
return __p.join("");
}
};
module.exports = tmpl;

##Use Example

gulp.src('./js/*/tmpl/*.ejs')
	.pipe(compiler('tmpl.js'))
	.pipe(gulp.dest('./dist/'));

License

This project is distributed under the MIT license.