I understand I can import lit-html using a <script type="module"> tag in say index.html, but I can't access html or render from a separate JS script (e.g. index.js). Is this currently possible?
How do I add lit-html to an existing project?
645 Views Asked by howMuchCheeseIsTooMuchCheese At
2
There are 2 best solutions below
0
On
Sorry for answering an old question, but the docs may have been updated since 2018. Now they provide instructions on how to do this.
npm install lit-html
Then import into your JS file like this:
import {html, render} from './node_modules/lit-html/lit-html.js';
Then you call html and render() where required (https://lit-html.polymer-project.org/guide/getting-started#rendering-a-template).
Use this CDN in your index.html
Hope this will resolve uour problem