JSPM

@tram-one/nanohtml

5.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q46404F
  • License MIT

A simple function for creating composable DOM elements using tagged template strings.

Package Exports

  • @tram-one/nanohtml
  • @tram-one/nanohtml/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tram-one/nanohtml) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@tram-one/nanohtml

Fork of a simple library for composable DOM elements using tagged template strings.

nanohtml is a library for translating template strings into DOM elements on the server and on the client.

Example

nanohtml can be used with other libraries (like hyperx) to create DOM trees.

const nano = require('nanohtml')
const hyperx = require('hyperx')

const html = hyperx(nano(), {comments: true})
const div = html`
  <div>
    <h1>This is in a DOM tree</h1>
  </div>
`

Namespaces

You can pass in a namespace to properly create namespaced elements (like svg)

const nano = require('nanohtml')
const hyperx = require('hyperx')

const svg = hyperx(nano('http://www.w3.org/2000/svg'), {comments: true})
const div = svg`
  <svg height="200" width="200">
    <rect width="100" height="100" />
  </svg>
`

You can use the nanohtml.html and nanohtml.svg instead of calling the top-level function

const nano = require('nanohtml')
const hyperx = require('hyperx')

const svg = hyperx(nano.svg, {comments: true})
const div = svg`
  <svg height="200" width="200">
    <rect width="100" height="100" />
  </svg>
`

original license

(c) 2016 Kyle Robinson Young. MIT License