Add npm install instruction to installation section similar to htmx.org
htmx.org does have instruction how to install it via NPM. Hyperscript is also install-able via NPM but this is not documented.
Would it be a good idea to highlight this also in the hyperscript documentation.
Example below from htmx.org replaced with hyperscript (checked the node_modules dir if it exists).
npm
For npm-style build systems, you can install hyperscript via [npm](https://www.npmjs.com/):
npm install hyperscript.org
After installing, you’ll need to use appropriate tooling to use node_modules/hyperscript.org/dist/_hyperscript.js (or .min.js). For example, you might bundle hyperscript with some extensions and project-specific code.
For some reason, when used from npm (and packaged with esbuild), it doesn't work.
import "htmx.org"
import "hyperscript.org"
htmx is working fine, does hyperscript require an extra step?
@ia3andy hyperscript works for me if I directly import it into my HTML. I have no luck by importing it into a typescript file and tanspiling it to JavaScript.
ok, after looking at the sources, this works:
import _hyperscript from "hyperscript.org";
_hyperscript.browserInit();
But maybe there is some way to avoid it (like htmx)?
With a bundler (I use parcel because it just works for simple projects) it is still clean I guess.
import 'htmx.org';
import _hyperscript from 'hyperscript.org';
_hyperscript.browserInit()
console.log("loading index.ts...");
And importing it in index.html as <script defer type="module" src="index.ts"></script> works.
_hyperscript is still in development:
hyperscript is under construction, working towards 1.0. While the syntax and features are largely complete, we're focused on more tests and docs.