hyperx-snabbdom

1.0.0 • Public • Published

This module is a fork of hyperx-to-snabbdom extended with a fix for whitespace inconsistency.

The module itself converts hyperx virtual dom build to a snabbdom-compatible output.

Usage:

npm i --save hyperx hyperx-snabbdom snabbdom

// patch.js

var snabbdom = require('snabbdom')
module.exports = snabbdom.init([ // Init patch function with chosen modules
  require('snabbdom/modules/class').default, // makes it easy to toggle classes
  require('snabbdom/modules/props').default, // for setting properties on DOM elements
  require('snabbdom/modules/style').default, // handles styling on elements with support for animations
  require('snabbdom/modules/eventlisteners').default // attaches event listeners
])

// html.js 

module.exports = require('hyperx')(
  require('hyperx-to-snabbdom')(require('snabbdom/h').default)
)

// my-module.js

var patch = require('./patch')
var html = require('./html')

function homeView () {
  return html`
    <body>
      <h1>Home view</h1>
    </body>
  `
}

patch(document.body, homeView())

Package Sidebar

Install

npm i hyperx-snabbdom

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • graforlock