@buxlabs/gulp-ejs-to-jst
v1.2.0
Published
gulp plugin that converts ejs to jst
Downloads
2
Readme
gulp plugin that converts ejs to jst
Installation
npm install @buxlabs/gulp-ejs-to-jst
Idea
The plugins converts ejs templates into functions. It can be useful if you want to compile your templates server side for better performance. The plugin returns a raw unnamed function so you should convert it further and e.g. wrap with cjs / amd or any other format of your choice.
Usage
Convert files with:
const gulp = require('gulp');
const converter = require('@buxlabs/gulp-ejs-to-jst');
module.exports = function (options) {
return gulp.src(options.src)
.pipe(converter())
.pipe(gulp.dest(options.dest));
};
Example:
ejs
<div>hello world</div>
jst
function(obj){var__t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};with(obj||{}){__p+='<div>helloworld</div>';}return__p;}