tired of having to create a giant boilerplate with 42 javascript files and fight for hours against buggy build tools, unhappy linters and unresolved type-checkers, I started a collection of nostr web components that hopefully can be imported with just a script tag and used directly:

, for example, just displays the name of the referred pubkey.

https://git.fiatjaf.com/nostr-web-components

I'm not sure this will work or if they will be very useful. let me know if you have suggestions of other components to create.

Reply to this note

Please Login to reply.

Discussion

my immediate use case for this was just to display the name of the app author without having to hardcode it or create giant javascript abyss on the new version of https://nostrapps.com/ (that hopefully will look exactly the same) that I'm porting to a more mentally sane setup after nostr:npub1r0rs5q2gk0e3dk3nlc7gnu378ec6cnlenqp8a3cjhyzu6f8k5sgs4sq9ac gave it to me.

Who is this for? Website builders? Web app devs?

Webmasters.

Using web components makes sense for many Nostr things

Like what?

A note, a reply to a note, raw data view of an event, a npub-to-follow button (and the inverse of it), a zap to a note, a thread with note replies and the note, etc etc

And this is a new learning resource of a Dutch dev which I follow (he is a PWA expert) https://dannymoerkerke.gumroad.com/l/mastering-web-components?ref=modern-web-weekly.ghost.io

This dev is doing a lot with web components https://gomakethings.com/articles/

This is something that would be good to follow if it was a Nostr feed and not a daily email.

Let’s build a RSS to Nostr feed bridge so everyone could load this as a custom feed into a client 🧐🤓

Storybook is a nice addition to showcase and document them !

How is that different from an HTML page that showcases them?

npm create osty@latest is what you need!

make view source great again

Here's a very colorful demo page of the components available so far: https://unpkg.com/nostr-web-components@0.0.3/demo.html

No build steps required.

> No build step required

Hacker news submission candidate

does each component connect and query or are the relay connections persistent?

They're reused by means of a magical technique known as a global variable. Results are also cached locally in another global.

I love this