This package has been deprecated

Author message:

this package is no longer maintained

ejstpl

4.0.0 • Public • Published

ejstpl

Compile ejs templates for use serverside and clientside.

Breaking Change in 4.0.0

version 4.0.0 uses ejs 2.0.0 which is not backwards compatible with lower versions. See https://github.com/diffsky/ejstpl/issues/1 for more detail.

Install

Globally

[sudo] npm -g i ejstpl

In a project

npm i ejstpl --save[-dev]

Usage

On the command line

  Usage: ejstpl [options]

  Options:

    -h, --help          output usage information
    -V, --version       output the version number
    -i, --input [glob]  glob string to find .ejs files
    -c, --cwd [dir]     directory to start globbing from
    -o, --output [dir]  directory to output compiled js files
    -v, --verbose       send progress to stdout

Programatically

var ejstpl = require('ejstpl');

// To compile templates to the filesystem:
ejstpl({
  cwd: <path to input dir>,
  output: <path to output dir>
})

By default ejstpl will glob for and compile `**/*.ejs` in the specified `cwd`. To
Glob for a different pattern, pass in a `input` property.

// To get an object with all the compiled templates for use serverside, omit the output option:
var templates = ejstpl({
  cwd: <path to input dir>
})
console.log(templates['foo']({data: 'hello'})

Clientside

When compiled for clientside use, ejstpl is designed to be used with dist/ejstpl.js for the ejs lib to use clientside.

Compiled templates can be rendered in the browser via:

ejs.tpl('templateName', opts);  // where opts is the data to be rendered

All compiled templates are in the ejs.tplc template cache.

Package Sidebar

Install

npm i ejstpl

Weekly Downloads

3

Version

4.0.0

License

MIT

Last publish

Collaborators

  • diffsky