template-literals-engine
v0.0.2-b
Published
```bash $ npm install template-literals-engine ```
Downloads
2
Readme
Template literals engine
Installation
$ npm install template-literals-engine
Example
index.js
const View = require('template-literals-engine');
var view = new View();
view.assign('title', 'Template literals engine');
view.assign('content', 'test');
console.log(view.render('index.html'));
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>${title}</title>
</head>
<body>
<div>${content}</div>
${include('footer.html')}
</body>
</html>
footer.html
<footer>
© ${(new Date).getFullYear()}
</footer>
Output
<!DOCTYPE html>
<html lang="en">
<head>
<title>Template literals engine</title>
</head>
<body>
<div>test</div>
<footer>
© 2019
</footer>
</body>
</html>