Writing a cool component library
Riot.js — Simple and elegant component-based UI library
Riot.js lets you build user interfaces with custom tags using simple and enjoyable syntax.
8 Replies
did you mean to post this in #resources or is there a question attached? @aolko
actually yes, there is a question - how to write your own cool library like that, but very barebones (microlibrary)?
very broadly, they seem to be using a compiler to generate web components. The compiler is also open source so you can poke around. https://github.com/riot/compiler
MDN has a bunch of resources on web components https://developer.mozilla.org/en-US/docs/Web/API/Web_Components
you do see the screenshot right?
that's what W3C does wrong
the goal is not to be like W3C
as for the compiler, we are talking barebones library, meaning no large moving parts
that's not about being like the W3C. That recommendation is primarily because the w3c might implement new tags in the future, and they guarantee they won't use any tags with dashes in them
so if you want to be sure your site won't break in the future, you should include dashes in your element names
"demands" is a bit of an overstatement though. If you want to validate using the w3c validator, sure... but browsers will just treat unknown tags as divs all day long
what if i want my tags
<with:namespaces>
?I'm not sure if colons are allowed characters in tag names in HTML
(actually any available tag name is allowed, the rest is styling problem)