This package has been deprecated

Author message:

This package has been deprecated, please use dom-plus instead.

create-element-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

DOM Generator

Very simple DOM generator with types declaration.

Installation

From NPM

# Via npm
npm install create-element-ts
# Or pnpm
pnpm add create-element-ts
# Yarn? sure
yarn add create-element-ts

Then import it to your project.

// ESM
import { h } from 'create-element-ts'
// CJS
const { h } = require('create-element-ts')

In browser

<script src="https://unpkg.com/create-element-ts/dist/index.umd.js"></script>
<script>
  const { h } = window.CreateElement
  // ...
</script>

Or... Why not ESM?

import { h } from 'https://unpkg.com/create-element-ts?module'
// ...

Usage

// step-1  - create element
const block = h('div', { class: 'foo' }, [h('span', 'bar'), 'baz'])
// step-2? - no more steps!
console.info(block.outerHTML) // <div class="foo"><span>bar</span>baz</div>

Package Sidebar

Install

npm i create-element-ts

Weekly Downloads

3

Version

1.0.2

License

MIT

Unpacked Size

11.5 kB

Total Files

9

Last publish

Collaborators

  • dragon-fish