Options
All
  • Public
  • Public/Protected
  • All
Menu

luciascript

luciascript

Hastscript-like utility to create HTML strings

Build Status Coverage Status NPM version Minzipped size

Installation

$ npm install luciascript
# Or with yarn
$ yarn add luciascript

Luciascript exports UMD, CJS, and ES builds.

// ES
import { l } from "luciascript";
// CJS
const { l } = require("luciascript");
// UMD
const { l } = window.Luciascript;

Usage

Luciascript has the following type declarations:

declare l(tag: string, props: Record<string, string> = {}, children: string[] | string[] = []) => string;

Given those properties it will generate HTML.

l("div", { className: "foo", id: "bar", style: "text-align: center;" }, [
    l("p", {}, "Hello World!"),
    l("button", {}, "Click Me!")
])
<div class="foo" id="bar" style="text-align: center;">
    <p>Hello World</p>
    <button>Click Me!</button>
</div>

Generated using TypeDoc