0.0.1 • Published 8 years ago
posthtml-code-gen v0.0.1
posthtml-code-gen
Convert a PostHTML AST into a Javascript function
Note: This project is in early development, and versioning is a little different. Read this for more details.
Installation
npm install posthtml-code-gen -S
Note: This project is compatible with node v6+ only
Usage
Usage is very straightforward. Just require the library and pass it a posthtml AST, and it will return a function as a string. When you call the function, it will return the resulting html as a string.
const generate = require('posthtml-code-gen')
const str = generate(['hello ', { type: 'expression', value: 'locals.planet' }])
const fn = eval(str)
console.log(fn({ planet: 'world' })) // 'hello world'
License & Contributing
- Details on the license can be found here
- Details on running tests and contributing can be found here
0.0.1
8 years ago