Mqx
Mqx•13mo ago

Deno + Lit

Hey how can use the Lit framework with Deno? Is there a guide or config on how to use it with this framework?
lit.dev
Lit
Simple. Fast. Web Components.
13 Replies
TurboJack
TurboJack•13mo ago
I'm looking for something simlar. I want to use https://shoelace.style/ with fresh SSR. Shoelace is built on top of lit.
Shoelace: A forward-thinking library of web components.
Hand-crafted custom elements for any occasion.
Kyiro
Kyiro•13mo ago
You can esbuild it yourself or use Aleph.js (actually no clue if it supports lit)
king8fisher
king8fisher•13mo ago
What a coincidence 😄 my favorite bird plus a similar desire to use shoelace. I only bumped into issues so far. May be someone could see what might be wrong. https://github.com/king8fisher/shoelace-style-deno/issues/1
GitHub
Attempt to use shoelace.style's SlButton fails · Issue #1 · king8fi...
Achieved: Deno sees the name of SlButton, apparently importing it correctly with intimidating link: import { SlButton } from "https://esm.sh/@shoelace-style/shoelace@2.8.0?alias=react:preact/c...
Mqx
Mqx•13mo ago
okay I will try esbuild
Kyiro
Kyiro•13mo ago
esbuild has a deno.land module btw
Mqx
Mqx•13mo ago
yea but this is just a link to the webpage xD But what I don't quite understand is this: Lit doesn't use a new syntax like React (TSX)... why or how do I have to build it at all? Or is ESBuild then only for bundling? Furthermore, I also have a little trouble getting Lit to run under Deno.... I import Lit from a CDN server. But in the examples everything is done via NPM (including the imports). As an example, how do I import the following NPM module into Deno? import {customElement} from 'lit/decorators.js';
Kyiro
Kyiro•13mo ago
if you use ts if you're using js, then you can skip esbuild import maps & esm.sh or just bare url imports https://esm.sh/lit@2.8.0/decorators.js
Mqx
Mqx•13mo ago
Thanks
jimmont
jimmont•13mo ago
awhile back I started a project intending to solve this problem of using Lit and a starter project myself, it's at: https://github.com/sourdough/starter
GitHub
GitHub - sourdough/starter: www starter 🦕
www starter 🦕. Contribute to sourdough/starter development by creating an account on GitHub.
jimmont
jimmont•13mo ago
it includes a few tools including for developing locally, this script shows the way PORT=8000 && deno run --allow-read=./ --allow-net=0.0.0.0:$PORT https://raw.githubusercontent.com/sourdough/starter/main/tools/http.js --port=$PORT --index=index.html --www=./www/
jimmont
jimmont•13mo ago
one of the other scripts in tools will pull down from one of the cdn's locally and I was pushing these externals (ie the lit/litelement etc libraries) into https://github.com/sourdough/wildtype so I could just clone the repo and work locally; I think it's the external.importer.js at https://github.com/sourdough/starter/blob/main/tools/external.importer.js I should work on this project a little more so it's easier to pick up; Lit is basically all that's needed for state management
GitHub
GitHub - sourdough/wildtype: external ES modules--all external tran...
external ES modules--all external transformed dependencies as static assets - GitHub - sourdough/wildtype: external ES modules--all external transformed dependencies as static assets
GitHub
starter/tools/external.importer.js at main · sourdough/starter
www starter 🦕. Contribute to sourdough/starter development by creating an account on GitHub.
Mqx
Mqx•13mo ago
Thanks for sharing
jimmont
jimmont•13mo ago
np, if you find something useful there it would be great to know the details--feel free to message about it