htl
htl copied to clipboard
How to use htl
Hi,
I installed the htl through npm, and want to use it in my browser. I have tried various methods and just could not make it work. Can anyone give me a hand?
I thought I read somewhere I can put some code as the following in my html
But no matter what, I cannot find it anywhere.
I would like to be able to use something like htl.svg, and htl.html in my scripts. How do I import htl ?
Thanks. Sean
If you want to include NPM modules directly in your front-end code, consider using esm.sh along with native JS modules:
<script type="module">
import { html } from "https://esm.sh/[email protected]"
document.body.appendChild(html`<h1>imported successfully`)
</script>
The following works on my web-page:
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
Then I can use e.g. htl.html
and htl.svg