4.0.0 • Published 9 years ago
ejstpl v4.0.0
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.
4.0.0
9 years ago
3.4.0
9 years ago
3.3.0
10 years ago
3.2.0
10 years ago
3.1.0
10 years ago
3.0.0
10 years ago
2.0.2
10 years ago
2.0.1
10 years ago
1.3.2
10 years ago
1.3.1
10 years ago
1.3.0
10 years ago
1.2.1
10 years ago
1.2.0
10 years ago
1.1.0
10 years ago
1.0.0
10 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