Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bcomnes/uhtml-isomorphic
Isomorphic exports of uhtml
https://github.com/bcomnes/uhtml-isomorphic
uhtml
Last synced: 7 days 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 (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-24T18:08:55.000Z (22 days ago)
- Last Synced: 2024-10-26T02:55:11.022Z (20 days ago)
- Topics: uhtml
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/uhtml-isomorphic
- Size: 56.6 KB
- Stars: 3
- Watchers: 3
- 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
[![Actions Status](https://github.com/bcomnes/uhtml-isomorphic/workflows/tests/badge.svg)](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