https://github.com/bcomnes/uhtml-isomorphic
Isomorphic exports of uhtml
https://github.com/bcomnes/uhtml-isomorphic
uhtml
Last synced: 8 months ago
JSON representation
Isomorphic exports of uhtml
- Host: GitHub
- URL: https://github.com/bcomnes/uhtml-isomorphic
- Owner: bcomnes
- License: mit
- Created: 2021-09-06T16:50:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-26T00:54:03.000Z (over 1 year ago)
- Last Synced: 2025-03-29T19:22:58.899Z (about 1 year ago)
- Topics: uhtml
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/uhtml-isomorphic
- Size: 58.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# uhtml-isomorphic
[](https://github.com/bcomnes/uhtml-isomorphic/actions)
Isomorphic exports of [uhtml][uhtml]
```
npm install uhtml-isomorphic
```
## Usage
Use [uhtml][uhtml] or [uhtml-ssr][ssr] from a single import identifier depending on then environment you are running.
``` js
import {render, html, svg} from 'uhtml-isomorphic';
// const {render, html, svg} = require('uhtml');
render(document.body, html`
Hello 👋 µhtml
`);
```
## How
While @webreflection recomends [require-overrides](https://github.com/WebReflection/require-overrides/#readme) in the offical documentation, that requires special flags or transforms to work.
`uhtml-isomorphic` works by utilizing environment specific exports fields so that you can have dependency injection at the built-in module resolver layer.
It supports the following export fields:
- `main` (cjs node)
- `browser` (cjs browser)
- `exports.import` (esm node)
- `exports.reqire` (cjs node)
- `exports.browser` (esm browser)
## License
MIT
[uhtml]: https://github.com/WebReflection/uhtml
[ssr]: https://github.com/WebReflection/uhtml-ssr