compile-htm
v1.0.0
Published
CLI tool to compile htm template literals into standard JavaScript builder functions for use with React, Preact, or other libraries.
Downloads
3
Readme
compile-htm
Compile JavaScript code with JSX htm template literals (html``) to standard javascript with builder functions over CLI.
This tool works with React, Preact or any other library using JSX syntax.
This uses babel-plugin-htm.
Instal
npm install -g compile-htmor access directly via npx:
npx compile-htm --helpUsage
compile-htm - v1.0.0
Compile htm template literal code to standard JavaScript builders
Positionals:
inputFile Input file path
Options:
--builder Builder function to use (default: h)
--output Output file to use (default: null)
Usage:
compile-htm <inputFile> [--builder functionName] [--output fileName]
compile-htm input.js Compile input.js into input.compiled.jsExample
html`<span>I use <div>Template</div><p with="properties">Strings!</p><${Box}><${Cat} /></${Box}></span>`will be converted into
h("span", null, "I use ", h("div", null, "Template"), h("p", {
"with": "properties"
}, "Strings!"), h(Box, null, h(Cat, null)));