Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The <template> tag really shines when used alongside <slot> and the Shadow DOM.

But I really wish there were an HTML-native way to load <template> from separate files, the same way we do with CSS and JS. Not a show-stopper, but it’d be very nice to have.



> But I really wish there were an HTML-native way to load <template> from separate files

Seems like the JS folks blocked this from happening. It's weird to me to think we've arrived at the point where JS considerations have come to dominate for something that was built to be a document sharing platform.


No one blocked it. If you're referring to HTML Imports, the problem with them is that they didn't integrate with JS modules. There's a new HTML modules proposal [1], and with JS import assertions and CSS and JSON modules landing [2], HTML modules are probably not far behind.

[1]: https://github.com/WICG/webcomponents/blob/gh-pages/proposal... [2]: https://web.dev/css-module-scripts/


goatlover: Seems like the JS folks blocked this from happening.

spankaalee: not true, they were removed because.... they were't compatible with JS

---

goatlover: JS considerations have come to dominate for something that was built to be a document sharing platform.

spankalee: here are two proposals which are... Javascript-only, don't work without javascript, and add more Javascript to the platform

---

¯\_(ツ)_/¯


> where JS considerations have come to dominate

Not JS. Chrome, and their decade-old crusade to make web components happen, no matter the cost or common sense


Yes, I thought that's what this article would be about. Respectfully, the MDN reference for <template> has more information than this post.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: