https://github.com/dotcypress/compile-template
📠Micro templates for Node.js
https://github.com/dotcypress/compile-template
Last synced: about 1 month ago
JSON representation
📠Micro templates for Node.js
- Host: GitHub
- URL: https://github.com/dotcypress/compile-template
- Owner: dotcypress
- License: mit
- Created: 2016-10-15T09:01:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-11-11T05:33:01.000Z (over 2 years ago)
- Last Synced: 2025-03-25T05:35:13.818Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/compile-template)
[](https://www.npmjs.com/package/compile-template)
[](https://travis-ci.org/dotcypress/compile-template)
[](http://standardjs.com/)# compile-template
> 📠Micro templates for Node.js> `js template literals` + `node vm` = `profit`
**Captain obvious alert**: 🚨 The node vm module is not a security mechanism. Do not use untrusted code in templates.
### Installation
Install from NPM:
```js
$ npm install compile-template --save
```**Note**: `compile-template` requires Node `4.0.0` or later
### Example
```js
const compile = require('compile-template')const template = compile('foo=${41+value}')
const string = template({value: 1})
assert(string === 'foo=42')const template = compile('foo=${41+value}', {value: 1})
assert(template() === 'foo=42')
```