choojs / hyperx

🏷 - tagged template string virtual dom builder
BSD 2-Clause "Simplified" License
1.01k stars 48 forks source link

Publish as UMD bundle #62

Closed jrop closed 2 days ago

jrop commented 6 years ago

Publishing as a UMD bundle allows for easy use in HTML pages via unpkg:

<script src="https://unpkg.com/hyperapp@1.0.1/dist/hyperapp.js"></script>
<script src="https://unpkg.com/hyperx@latest/dist/hyperx.min.js"></script>
<script>
  const {app, h} = hyperapp
  const hx = hyperx(h)
  const main = app(
    {}, // state
    {}, // actions
    () => hx`<div>Hello from HyperX!</div>`,
    document.getElementById('root')
  )
</script>

This change is completely backward-compatible and supports:

This mirrors how React is publishing their module as well. See: https://unpkg.com/react@16.2.0/cjs/

jrop commented 6 years ago

Here is a demo of it in action on CodePen.

tsjnsn commented 6 years ago

This would be really nice

jrop commented 6 years ago

@tsjnsn For the moment, I published a single version of a UMD build of this package here:

https://www.npmjs.com/package/@jrop/hyperx

I still would like to have this merged though :/

goto-bus-stop commented 6 years ago

personally i'm cool with publishing UMD builds. I know not everyone in the choojs org likes em tho. you can also use https://wzrd.in/standalone/hyperx which browserifies a UMD build on the fly.

mreinstein commented 2 days ago

the ecma world has chosen es modules for the module standard. closing this in favor of #85