@newy/dsl
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

一个描述 name, attribute, children 结构 的内部DSL

示例

import init from '@newy/dsl'

let { n } = init()
let { div, a, img, h1, p, button } = n

let dom = div(
  a`href="https://vitejs.dev" target="_blank"`(img`src=${src1} class="logo" alt="Vite logo"`),
  a`href="https://www.typescriptlang.org/" target="_blank"`(
    img`src=${src2} class="logo vanilla" alt="TypeScript logo"`
  ),
  h1('Vite + TypeScript'),
  div`class="card"`(button`id="counter" type="button"`),
  p`class="read-the-docs"`('Click on the Vite and TypeScript logos to learn more')
)

console.log(dom)

Readme

Keywords

Package Sidebar

Install

npm i @newy/dsl

Weekly Downloads

66

Version

0.1.2

License

MIT

Unpacked Size

5.85 kB

Total Files

7

Last publish

Collaborators

  • newy