🚀 DAY 4 OF LAUNCH WEEK: Introducing GitHub Actions Scanning Support.Learn more →
Socket
Book a DemoInstallSign in
Socket

compile-htm

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compile-htm

CLI tool to compile htm template literals into standard JavaScript builder functions for use with React, Preact, or other libraries.

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

compile-htm

NPM version Build Status Gitpod ready-to-code

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-htm

or access directly via npx:

npx compile-htm --help

Usage

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.js

Example

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)));

FAQs

Package last updated on 05 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts