1.1.1 • Published 5 years ago

ejs-compiler v1.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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