News for hackers. Stuff that matters.
Re:Implementing single-file web components by TekMol on Monday March 23, 2020 @11:28AM (#22665009)
It is insane that HTML has no "include". None of all this would be needed if we could just do:

<include src="myComponent.html>

Re:Implementing single-file web components by woodrowbarlow on Monday March 23, 2020 @11:34AM (#22665053)
it was proposed and implemented, then the standards body did an about-face.

https://hacks.mozilla.org/2015/06/the-state-of-web-component... (ctrl+f "HTML Imports")

"HTML Imports do lend themselves well to a simpler/more declarative workflow. [...] Imports don’t offer enough control to be taken seriously as a dependency management solution. [...] Mozilla had a working implementation behind a flag, but struggled through an incomplete specification."

which to me reads a bit like: "js frameworks won't use it, and the spec didn't get enough love because everybody's only thinking about frameworks rather than vanilla-js."

Re:Implementing single-file web components by tomphoolery on Monday March 23, 2020 @12:23PM (#22665511)
Actually, they are waiting for module Imports to standardize and get some actual real-world usage. Once that happens, they may move onto HTML Imports. But I feel like they could probably get away with just doing `import Template from "./somefile.html"` using module resolvers.
Re:Implementing single-file web components by goatlover on Monday March 23, 2020 @01:32PM (#22666395)
It's disappointing that JS Frameworks are driving the HTML spec.
Re:Implementing single-file web components by spankalee on Monday March 23, 2020 @05:48PM (#22669182)
HTML Imports was not an <include> mechanism though.

It was much more akin to JS imports. HTML files would be side-effectful, then you could use the elements they defined, like <x-foo>.

Re:Implementing single-file web components by chrisfinazzo on Monday March 23, 2020 @01:24PM (#22666287)
Sigh.

A web that was built on documents fragments because the JS and server-side developers think writing raw HTML and CSS is gross.

Email developers would like a word with them.

This isn't going away, and at some point, adding more abstractions is actually harmful.

As I have little else to do at this point - Tl;dr When you work for a public library, but are closed the public, nothing happens - I'm rewriting a small microsite I made for job hunting purposes.

Other than a Service Worker cache, it's markup and styles all the way down, stitched together with Make.

For my blog, I've stuck with Liquid, because Jekyll - which I actually like (ducks) - will be interesting to see if this gets revived and actually lands one day.

Re:Implementing single-file web components by the_other on Monday March 23, 2020 @02:03PM (#22666798)
_This_ front end developer _loves_ writing HTML and CSS, regardless of my previous several years of JS, React, Angular, Backbone etc.
Re:Implementing single-file web components by woodrowbarlow on Monday March 23, 2020 @01:43PM (#22666560)
would you mind sharing the source or stack for your microsite? your setup sounds like something i'd enjoy using.
Re:Implementing single-file web components by chrisfinazzo on Monday March 23, 2020 @02:36PM (#22667154)
Code is here - https://github.com/chrisfinazzo/reverse-job-posting

Started on GH Pages, but moved to Netlify which gives me a bit more fine grained control.

Pardon the dust;

First, I'm not a graphic designer and second this is actually an older deploy that I've "locked" so I can continue tinkering with the master branch behind the scenes. Will be a single page with just anchors to navigate when done.

Everything old is new again. Homepages, kids, ask your parents about them :)

Re:Implementing single-file web components by chrisweekly on Monday March 23, 2020 @03:49PM (#22667991)
I vaguely recall doing things with server-side includes and ".shtml" in the late '90s...
Re:Implementing single-file web components by getpost on Tuesday March 24, 2020 @11:41AM (#22675486)
I still have a website that uses server-side includes fro the navbar and other common page elements.

https://en.wikipedia.org/wiki/Server_Side_Includes

Re:Implementing single-file web components by dfabulich on Monday March 23, 2020 @04:23PM (#22668329)
There's a web component for that! https://github.com/justinfagnani/html-include-element

    <script type="module" src='https://unpkg.com/html-include-element'></script>
    <html-include src="./my-local-file.html"></html-include>
Re:Implementing single-file web components by stevekemp on Monday March 23, 2020 @02:12PM (#22666885)
Back in the day we had something which was often used:

<!--#include virtual="/cgi-bin/counter.pl" -->

Re:Implementing single-file web components by 101404 on Monday March 23, 2020 @12:48PM (#22665829)
That was the original web components. Much better. Then they changed it to make it worse. :(
Re:Implementing single-file web components by tasogare on Monday March 23, 2020 @01:43PM (#22666553)
Yeah I remember reading about web components, getting excited and building a prototype. Then when I worked again on the project shadow DOM API changed and HTML imports were removed :| At this point I highly suspects the people behind the Web shit-show (spec writers and implementors) keep things bad on purpose as a way to get job security.
Re:Implementing single-file web components by tannhaeuser on Monday March 23, 2020 @01:20PM (#22666232)
That, and much more, is implemented in SGML on which HTML is based.
Re:Implementing single-file web components by AtlasBarfed on Monday March 23, 2020 @12:54PM (#22665895)
Then why not a templating language with looping constructs until it is Turing complete? Because base HTML is a document not a document generation language. Um, until javascript. Oh well.

Thus JS library references basically enable HTML includes.

Re:Implementing single-file web components by woodrowbarlow on Monday March 23, 2020 @01:28PM (#22666336)
a document that supports embedding other documents is still just a document.
Re:Implementing single-file web components by e12e on Monday March 23, 2020 @03:55PM (#22668056)
Ah, but a document that supports including itself, that's the bomb!
Re:Implementing single-file web components by pcr910303 on Monday March 23, 2020 @01:31PM (#22666386)
That wouldn't be a solution to everything, but at least it would be a starting point to defining a fully-declarative custom element solution so that custom elements can be used in a non-JS context.