Need private packages and team management tools?Check out npm Teams »

@buxlabs/gulp-ejs-to-jst

1.2.0 • Public • Published

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;}

Install

npm i @buxlabs/gulp-ejs-to-jst

Version

1.2.0

License

MIT

Last publish

Collaborators

  • avatar
  • avatar