Skip to content

Latest commit

 

History

History
60 lines (45 loc) · 1.43 KB

README.md

File metadata and controls

60 lines (45 loc) · 1.43 KB

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!")
])

or, with classes

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