package
browserify transform for hyperx
npm install hyperxifyGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 13 packages.
1.2 MB
Includes dependencies.
browserify transform for hyperx
This module will compile your hyperx template strings down to javascript expressions so that you don't need to send the hyperx library over the wire.
Given some hyperx code:
var vdom = require('virtual-dom')
var hyperx = require('hyperx')
var hx = hyperx(vdom.h)
var main = require('main-loop')
var loop = main({ times: 0 }, render, vdom)
document.querySelector('#content').appendChild(loop.target)
function render (state) {
return hx`<div>
<h1>clicked ${state.times} times</h1>
<button onclick=${onclick}>click me!</button>
</div>`
function onclick () {
loop.update({ times: state.times + 1 })
}
}Compile with browserify using -t hyperxify:
$ browserify -t hyperxify main.js > bundle.jsIf you look in the bundle.js file, you can see that the hyperx template
strings have been replaced with calls to vdom.h, which is how hyperx was
invoked:
$ <bundle.js head -n16 | tail -n+2
var vdom = require('virtual-dom')
var hyperx = 0
var hx = 0
var main = require('main-loop')
var loop = main({ times: 0 }, render, vdom)
document.querySelector('#content').appendChild(loop.target)
function render (state) {
return vdom.h("div",{},["\n ",vdom.h("h1",{},["clicked ",state.times," times"]),"\n ",vdom.h("button",{"onclick":onclick},["click me!"]),"\n "])
function onclick () {
loop.update({ times: state.times + 1 })
}
}BSD
benlyn
bendik.lynghaug@gmail.com
bret
bcomnes@gmail.com
lrlna
shestak.irina@gmail.com
yerkopalma
yerko.palma@usach.cl
juliangruber
julian@juliangruber.com
timwis
tim@timwis.com
ahdinosaur
michael.williams@enspiral.com
toddself
todd@selfassembled.org
sethvincent
sethvincent@gmail.com
maxogden
max@maxogden.com
shama
kyle@dontkry.com
freeman-lab
jeremy.freeman@mac.com
feross
feross@feross.org
emilbayes
github@tixz.dk
colingourlay
colin@colin-gourlay.com
jameskyburz
james.kyburz@gmail.com
almost
tom@almostobsolete.net
slaskis
robert@publicclass.se
ungoldman
ungoldman@gmail.com
graforlock
neatcube@gmail.com
tornqvist
carl@tornqv.ist
amongiants
jon@folderstudio.com
goto-bus-stop
npm@asdf.kooi.me
mafintosh
mathiasbuus@gmail.com