Jbasoo,
@Jbasoo@mastodon.social avatar

I've just started learning #webComponents and oh my days there seems to be a lot of ways to boilerplate this. Should I just use #Lit? It looks like I'd need a bundler which seems overkill for my tiny #11ty site.

Also, are there any good courses around?

schizanon,
@schizanon@mas.to avatar

@Jbasoo have you tried @enhance_dev?

It's not really "web components" because it's all server-side rendered; client-side is up to you, but bundling is provided for free! There are examples of people using it with Lit, MorphDOM and other client-side dom-diffing libraries.

Jbasoo,
@Jbasoo@mastodon.social avatar

@schizanon @enhance_dev not yet, I've heard a lot of hype about it this week so that's another thing I should look into 😆

schizanon,
@schizanon@mas.to avatar

@Jbasoo @enhance_dev it's pretty simple to get into, and if you are at all interested in #serverless #AWS #Lambda #FaaS stuff it's based on https://arc.codes so it's good at that stuff too!

enhance_dev,
@enhance_dev@fosstodon.org avatar

@schizanon @Jbasoo If you don't think they are "real" web components wait until you see what's coming up next. Hit up @macdonst for a preview.

schizanon,
@schizanon@mas.to avatar

@enhance_dev @Jbasoo @macdonst it's not a Web Component until it's Custom Element is registered in the browser; until then it's just sparkling html ;-)

macdonst,
@macdonst@mastodon.online avatar

@schizanon @enhance_dev @Jbasoo I do love sparkling html. I’m in Australia this week but ping me next week for a demo of SSR/CSR web components.

schizanon,
@schizanon@mas.to avatar

@macdonst @enhance_dev @Jbasoo the MorphDOM thing?

tbroyer,
@tbroyer@piaille.fr avatar

@Jbasoo You don't necessarily need a bundler with Lit, you can use prebuilt bundles (https://lit.dev/docs/getting-started/#use-bundles), or import maps (https://lit.dev/docs/tools/requirements/#building-for-modern-browsers)

As for a course, have a look at Rob Eisenberg posts on Medium. He has a course coming on Nov 7.
https://eisenbergeffect.medium.com/

Jbasoo,
@Jbasoo@mastodon.social avatar

@tbroyer I was a bit confused about that, the docs say don't use the pre-built bundle client side but install the package instead. However the npm package doesn't seem to be usable without a bundler?

Cool, I might check out the course when it drops.

schizanon,
@schizanon@mas.to avatar

@Jbasoo @tbroyer for a production hardened site there are some concerns about depending on modules from a third party origin, that's generally why it's discouraged. But you shouldn't optimize until you have users. CDNs are fine for development.

Jbasoo,
@Jbasoo@mastodon.social avatar

@schizanon @tbroyer The docs warn about it probably including more than you need. It's probably a personal thing but I don't mind using the bloated, insecure version for learning the basics but I don't want to learn bad habits if it's something I'm aiming to use in production, regardless of how many users I have.

schizanon,
@schizanon@mas.to avatar

@Jbasoo @tbroyer YAGNI 😉

Jbasoo,
@Jbasoo@mastodon.social avatar

@schizanon haha, yeah you're right. If I was only going to use it on my personal site I might just go for it but as I could end up using on something larger for work I just want to learn how to build with it at a bigger scale.

schizanon,
@schizanon@mas.to avatar

@Jbasoo I don't think that bundling is really specific to web components; if you learn to use Rollup or Webpack it's the same whether you're doing Lit, or React.

The real scaling problem is application complexity; lots of components nested in each other's shadow doms, sharing state via Signals, or Context, or whatever.

Lit has some new packages for managing state like https://www.npmjs.com/package/lit-context and https://www.npmjs.com/package/@lit-labs/preact-signals you should try out!

tbroyer,
@tbroyer@piaille.fr avatar

@Jbasoo @schizanon Well, either you want something optimized and you probably want a bundler then (you could also use the "core" bundle, I doubt it includes much more than you'd need, but your code won't be optipized), or you want something easy to use for a tiny website and you can use prebuilt bundles (and use subresource integrity for better security when loading from a CDN)

tbroyer,
@tbroyer@piaille.fr avatar

@Jbasoo You can use the NPM package with import maps. You could also have a look at CDNs like esm.sh and/or esm.run.

ttntm,
@ttntm@fosstodon.org avatar

@Jbasoo maybe also have a look at a brand new toy that @ayo is working on: https://social.ayco.io/@ayo/111274431548104906

ayo,
@ayo@ayco.io avatar

@ttntm @Jbasoo Yeah definitely this can help: https://ayco.io/n/web-component-base

If you want easier and more enjoyable crafting time, try out: https://ayco.io/gh/mcfly

Feedbacks welcome! ;)

Jbasoo,
@Jbasoo@mastodon.social avatar

@ayo @ttntm interesting, I'll check that out, thanks!

westbrook,
@westbrook@mastodon.social avatar

@Jbasoo this one https://www.bluespire.com/p/web-component-engineering by Rob Eisenberg is quite the resource!

Jbasoo,
@Jbasoo@mastodon.social avatar

@westbrook oh wow, that looks extensive and expensive. I'd need to convince my employer to get that 😅

westbrook,
@westbrook@mastodon.social avatar

@Jbasoo Rob’s deeply tied into everything that’s going on with at the W3C level. Checkout his recent review of this years TPAC as a preview of what you might experience therein: https://eisenbergeffect.medium.com/web-components-at-tpac-2023-f6da57519eb9

Jbasoo,
@Jbasoo@mastodon.social avatar

@westbrook I think I skimmed that when it was posted but the jargon was a bit beyond my current understanding.

heybran,
@heybran@mastodon.online avatar

@Jbasoo Here’s few resources that I collected when I was starting to learn Web Components. https://github.com/heybran/web-components-resources

Jbasoo,
@Jbasoo@mastodon.social avatar

@heybran Nice collection, thanks!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • 11ty
  • tacticalgear
  • thenastyranch
  • ethstaker
  • everett
  • Durango
  • rosin
  • InstantRegret
  • DreamBathrooms
  • magazineikmin
  • Youngstown
  • mdbf
  • slotface
  • GTA5RPClips
  • kavyap
  • JUstTest
  • tester
  • cubers
  • cisconetworking
  • ngwrru68w68
  • khanakhh
  • normalnudes
  • provamag3
  • Leos
  • modclub
  • osvaldo12
  • megavids
  • anitta
  • lostlight
  • All magazines