posthtml-code-gen

0.0.1 • Public • Published

posthtml-code-gen

npm tests dependencies coverage

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

Readme

Keywords

none

Package Sidebar

Install

npm i posthtml-code-gen

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • jescalan