ejss
v1.2.3
Published
Tools to convert EJS to HTML with detailed options.
Downloads
8
Readme
ejss
Tools to convert EJS to HTML with detailed options.
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>
-->