as-html
Simple html templates with es6 quasi literals. You can also minify the templates using babel-plugin-as-html.
Inspired by http://www.2ality.com/2015/01/template-strings-html.html.
Installation
Npm
$ npm install as-html
Example
// commonjsvar html = // es6 // exampleslet planet = 'world' html` Hello ` //-> '<div>Hello world</div>' // safe by defaultplanet = 'crazy<planet>' html` Hello ` //-> '<div>Hello crazy<planet></div>' // or insert html by prefixing with a bang!html` Hello !` //-> '<div>Hello crazy<planet></div>' // arrays are supported as well (automatically unescaped)!let planets = 'a' 'b' 'c' html` ` //-> '<div><b>a</b><b>b</b><b>c</b></div>'
Contributions
- Use
npm test
to run tests.
Please feel free to create a PR!