1.2.3 • Published 5 years ago

ejss v1.2.3

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

ejss

Tools to convert EJS to HTML with detailed options.

NPM Build Status MIT License

Installation

NPM

$ npm install ejss --save

Usage

CLI

Options:
  --src           src files path pattern. [string] [default: './src/ejs/**/*.ejs']
  --dest          dest directory path. [string] [default: './dest/']
  --data          data json file path. [string] [default: './src/ejs-data.json']
  --compression   whether to compression. [bool] [default: false]
  --lint          htmlhint config file path. [string] [default: '']
  --version, -v   show this version. [boolean]
  --help, -h      show this help. [boolean]
$ ejss --src ./src/ejs/**/*.ejs --dest ./dest/ --data ./src/ejs/data.json --compression true

JavaScript

ejss({
  src: './src/ejs/**/*.ejs',
  dest: './dest/',
  data: './src/ejs-data.json',
  compression: false,
  lint: './.htmlhintrc.json'
}).then(() => {
  console.log('Complete!!');
});

JSON

{
  "common": {
    "description": "dummy text."
  },
  "page": {
    "/index.html": {
      "title": "Index"
    },
    "/about.html": {
      "title": "About"
    }
  }
}

EJS

/index.ejs

<html>
  <h1><%= page.title %></h1>
  <p><%= common.description %></p>
</html>

<!--
<html>
  <h1>Index</h1>
  <p>dummy text.</p>
</html>
-->

/about.ejs

<html>
  <h1><%= page.title %></h1>
  <p><%= common.description %></p>
</html>

<!--
<html>
  <h1>About</h1>
  <p>dummy text.</p>
</html>
-->

Changelog

License