News for hackers. Stuff that matters.
Re:Pylon – Declarative layout primitives for CSS and HTML by pier25 on Tuesday June 11, 2019 @09:55AM (#20155390)
The resulting HTML is not great, but the dev experience looks super nice.

Maybe we need to introduce HTML transpilers now :)

Re:Pylon – Declarative layout primitives for CSS and HTML by lioeters on Tuesday June 11, 2019 @10:43AM (#20155851)
I've been building and using various forms of HTML transpilers for several years, as part of a build step or "JIT" during server-side rendering.

The main advantage I see is the ability to extend HTML to have layout/templating functions, building up a simple DSL for frontend devs and editors. Since the target userbase is already familiar with HTML syntax, it's easy to learn and gives them "super powers" - for example, an <include> tag that imports another HTML file/partial.

Another use case I've used in a number of sites/applications: chaining a Markdown parser, an HTML transpiler, and a React renderer for the HTML "AST". Among other things, it renders internal links <a> as <Link> components of the router.

And the rabbit hole goes deep: the XML/HTML syntax is actually able to represent "programs" in a Lisp-like manner. If the angle brackets are too noisy, one can use Jade/Pug syntax to generate the same AST.

In the end, the traspiler should render the result in standards-compliant HTML. This Pylon project doesn't transpile anything, so the result contains undefined tags which the browser treats as HTMLUnknownElement [0]. The bottom line though, is that it works - and I've seen numerous projects in the wild taking advantage of this behavior.

I'd also like to mention the posthtml project [1]. I haven't used it myself, but a generic HTML transpiler has great potential in my opinion.

[0] https://developer.mozilla.org/en-US/docs/Web/API/HTMLUnknown...

[1] https://github.com/posthtml/posthtml

Re:Pylon – Declarative layout primitives for CSS and HTML by ben509 on Tuesday June 11, 2019 @02:11PM (#20157975)
> And the rabbit hole goes deep: the XML/HTML syntax is actually able to represent "programs" in a Lisp-like manner.

XML was always a poor man's s-expression.

And for all the sins of SGML, tags lend themselves beautifully to templating because they can represent code as data just as Lisp does.

Re:Pylon – Declarative layout primitives for CSS and HTML by Siilwyn on Tuesday June 11, 2019 @10:07AM (#20155502)
Re:Pylon – Declarative layout primitives for CSS and HTML by nickthemagicman on Tuesday June 11, 2019 @10:47AM (#20155895)
Only one layer of transpilation? Rookie numbers. I can get javascript up to 4 or 5 layers on a good day.
Re:Pylon – Declarative layout primitives for CSS and HTML by dandigangi on Tuesday June 11, 2019 @01:16PM (#20157418)
Hah!