Tools to convert EJS to HTML with detailed options.
$ npm install ejss --save
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
ejss({
src: './src/ejs/**/*.ejs',
dest: './dest/',
data: './src/ejs-data.json',
compression: false,
lint: './.htmlhintrc.json'
}).then(() => {
console.log('Complete!!');
});
{
"common": {
"description": "dummy text."
},
"page": {
"/index.html": {
"title": "Index"
},
"/about.html": {
"title": "About"
}
}
}
<html>
<h1><%= page.title %></h1>
<p><%= common.description %></p>
</html>
<!--
<html>
<h1>Index</h1>
<p>dummy text.</p>
</html>
-->
<html>
<h1><%= page.title %></h1>
<p><%= common.description %></p>
</html>
<!--
<html>
<h1>About</h1>
<p>dummy text.</p>
</html>
-->