Reputation: 1780
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?
Upvotes: 0
Views: 836
Reputation: 2803
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).
Upvotes: 1
Reputation: 36
Use this CDN in your index.html
<script>https://cdn.jsdelivr.net/npm/[email protected]/lit-html.d.ts</script>
<script>https://cdn.jsdelivr.net/npm/[email protected]/lit-html.d.ts.map</script>
<script>https://cdn.jsdelivr.net/npm/[email protected]/lit-html.js.map</script>
Hope this will resolve uour problem
Upvotes: 0