Comment by moffkalast
3 years ago
This reminds me, I'd argue that the explosion of JS frameworks can be mainly blamed on one thing: the lack of an <include src="somemodule.html"> tag. If you have that you basically have 80% of vue.js already natively supported. No clue why this was never added in any fashion. Change my mind.
HTML imports were part of the original concept of Web Components, and I think they were supported in Chrome. If you look up examples of things built with Polymer 1.x, it was used extensively.
It was actually pretty neat, because you could have an HTML file with a template, style, and script section.
Safari rejected the proposal, so it had to get dropped.
But ESM makes it a bit redundant anyway. The end-goal is to allow you to import any kind of asset, not just JS. There have been demos and examples of tools supporting this going back over half a decade at this point.
Firefox refused the proposal as well. ESM requires javascript though. :/
My admiration for Mozilla and Apple grows every day /s
1 reply →
It's funny I read that and I remember Apache's virtual-include facility:
I used that, back in the day, as an alternative to PHP.
Wouldn't the include still need some templating functionality? Or are people using vue that heavily for just importing static html?
Not the parent comment, but my personal use case is for rendering a selectable list. The server side would render a static list with fragment links (ex. `#item-10`) and include elements with corresponding IDs, and a `:target` css rule to unhide the element. This would hopefully be paired with lazy loading the include elements.
edit:
My goal is to avoid reloading the page for each selection and rendering all items eagerly. JS frameworks are the only ones that really allow this behavior.
> https://caniuse.com/imports
It was a feature in Chrome 36-79 and there were working polyfills to make it work on other browsers.
It was actually a great feature and I used it extensively on an old project back then.
CanIUse: https://caniuse.com/imports
(Now obsolete) tutorial: https://www.sitepoint.com/introduction-html-imports-tutorial...
I wonder why there's never been a
Basically what php does but with structure and objects instead of a bytestream
in HTML. Or maybe it's been discussed but got left out
It's always been possible:
<script>document.write(`<p>foo</p>`)</script>
Good point, but it's very different in terms of thinking. Same as structural versus string macros in programming languages.
1 reply →
How would <include> be useful for dynamically updating the DOM based on data, which is the main point of Vue?
Is <script type="module" /> not sufficient for your needs? If not then what is missing?
Seems to be arguing for modular layout/templating, which is what virtual includes did (the cgi in the example would hypothetically output html)