News for hackers. Stuff that matters.
Re:Ways to make a web component by olex on Friday July 17, 2020 @01:30PM (#23873094)
This is exactly how vue.js "single file components" work - a <template> with the "bunch of html", <script> and optional <style> blocks.
Re:Ways to make a web component by clairity on Friday July 17, 2020 @01:46PM (#23873305)
that's pretty close to what i'm thinking of, but still has some limitations (from https://vuejs.org/v2/guide/single-file-components.html):

• Global definitions force unique names for every component

• String templates lack syntax highlighting and require ugly slashes for multiline HTML

• No CSS support means that while HTML and JavaScript are modularized into components, CSS is conspicuously left out

• No build step restricts us to HTML and ES5 JavaScript, rather than preprocessors like Pug (formerly Jade) and Babel

Re:Ways to make a web component by shhsshs on Friday July 17, 2020 @08:40PM (#23877821)
You may be misunderstanding (or I’m not understanding your intent). Single-file components were made specifically to overcome those issues, as mentioned on the page you linked.
Re:Ways to make a web component by clairity on Saturday July 18, 2020 @02:48PM (#23883767)
apologies, i did misread the page i quoted from. it does seem like i need to explore these single-file vue components more.