Skip to content
An opinionated ejs template compiler cli
Branch: master
Clone or download
Johannes Rudolph
Latest commit 5879e6e Jan 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test feat: add context option to read json file Oct 16, 2018
.gitignore
LICENSE
README.md
package.json
tsconfig.json initial commit Oct 16, 2018
tslint.json
yarn.lock initial commit Oct 16, 2018

README.md

ejsc

An opinionated ejs template compiler utility command line app.

Orchestrates compilation via ejs, ejs-lint and provides a --watch function via chokidar. Makes lodash available in ejs templates via _.

Installation

npm install ejsc --global

Usage

ejsc [template]

Positionals:
  template  template file to compile

Options:
  --version  Show version number                                       [boolean]
  --include  include directory (globs **.ejs files)
  --watch    continuously watch template and include dir for changes
  --outFile  output file                                              [required]
  --help     Show help                                                 [boolean]

Example

Compile a simple template:

$ ejsc test/simple.ejs --outFile simple
rendering test/simple.ejs: 0.729ms

Watching for changes contiuously (don't forget to specify --include):

$ ejsc test/simple.ejs --include test/include --outFile simple --watch
rendering test/simple.ejs: 0.729ms
rendering test/simple.ejs: 2.098ms
...

Make context data available to the template, e.g. context.json:

$ ejsc test/simple.ejs --context test/context.json --outFile simple
rendering test/simple.ejs: 0.729ms
You can’t perform that action at this time.