JSPM

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

Composable snabbdom virtual-nodes using tagged template strings

Package Exports

  • snabbx

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 (snabbx) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Snabbx

npm (scoped) Travis Coveralls XO code style

Composable snabbdom virtual-nodes using tagged template strings

Table of contents

Install

This project uses node and npm. Go check them out if you don't have them locally installed.

$ npm install --save snabbx

Usage

import {html, render} from 'snabbx'

const app = html`<h1>Hello world!</h1>`

render(document.getElementById('app'), app)

API

html

Create a virtual node.

Parameters

  • template string HTML template.

Examples

html`
  <div>
    <p>Hey <span class="span">There</span></p>
    <div></div>
    dom
  <div>
`

Returns Object a virtual node.

render

Make the diff of two virtual node and render them.

Parameters

  • oldNode Object virtual node to be modified.
  • newNode Object virtual node to be rendered.

Examples

const oldNode = html`
  <div>
    <p>Hey <span class="span">There</span></p>
    <div></div>
    dom
  <div>
`

const newNode = html`
  <div>
    Hello
  <div>
`

render(oldNode, newNode)

Contribute

See the contributing file.

License

MIT License © Gustavo P Borges