Hacker News new | past | comments | ask | show | jobs | submit login

Is there a reason why there seemingly aren't any frameworks to do all the fancy web flourish in a normal language and then have it compile down to plain HTML5 + CSS + SVG?



You can compile almost any language to JS or WASM.

As to HTML + CSS: it goes other way around: HTML and CSS (or rather its subsets) are being integrated into "normal languages", like Qt, Java. I'm not sure I ever saw any technology that could serve as a replacement for HTML + CSS. May be Eclipse RAP or Blazor? But they are so heavy that React will look like a butterfly and they're not aiming to replace HTML/CSS but rather just use it as output medium for their UI.


> As to HTML + CSS: it goes other way around...

Yeah that kind of stuff is closer but most of those types of frameworks seem to lean heavily on mapping to JS because they try to be turing complete rather than just being easy to work with DSLs.


Reasons:

- Browsers don't "talk" any other language but JS

- All browser APIs are exposed through JS only

- You can't manipulate DOM except through JS

- You can't do "fancy web flourish" without manipulating DOM. If you target Canvas/WebGL/WebGPU, you'd have to first create your entire graphics lib + flourish + font handling and rendering + accessibility + ... from scratch. And load all that on every page load

- Any language compiling into WASM would still need JS-integration for any of the above. Including Canvas/WebGL/WebGPU

- Any language without JS and DOM semantics will need to account for that (e.g. GC on DOM nodes)

- Any language compiling to WASM would need to load its runtime to actually run (including any libs). See network tab for any such project. e.g. Blazor


> - Browsers don't "talk" any other language but JS

I'm not looking for browsers to talk with any language. I'm looking for some DSL that directly maps to the 3 layout languages that browsers understand (i.e. HTML + CSS + SVG). Not anything turing complete at runtime but rather a sane way of describing a webpage layout with fancy styling, UI elements, transitions, and animations but without dealing with the pain that comes with actually writing in the native browser layout languages.

> You can't do "fancy web flourish" without manipulating DOM.

There is a lot of web flourish you can do without manipulating the DOM. It's not actually terribly unperformant to do but writing that code (mostly HTML + CSS, occasionally SVG) feels like peeling your eyelids with an unwashed lemon zester.

> ...

And for the rest of that, again I'm not looking for anything that actually executes in the browser. Just a sane, modern layout language that compiles down to static HTML and CSS with no JS or WASM (unless you explicitly ask for it).


The web spec is so complex because it serves different masters. You either making a web page, a web app, or some hybrid of the two. And there’s different constraints for each. And you will have to choose which subset to target if you were the one building that modern language.


Yep. Again, I'm not looking for a perfect global solution.

Just some domain specific language for writing sane low-to-no-js web pages or parts of web pages without having to manually fiddle with HTML or CSS in any real amount.

Static site generators honestly get me a lot of the way there but those are unfortunately template based which means any significant customisation requires dealing with the HTML and CSS rather than being able to just describe the layout and behavior I want.

Honestly I'd just write the compiler/lang myself if I didn't hate frontend so much.


> Just a sane, modern layout language that compiles down to static HTML and CSS with no JS or WASM (unless you explicitly ask for it).

Depends on what you mean by sane modern layout :)

Many modern layouts are still impossible without a lot of JS intervention. Many web flourishes also require Javascript :)

That's why there are no DSLs for this: HTML and CSS already are the DSLs you're looking for.


Sounds like you might be looking for a Static Site Generator. Astro was already mentioned. There's plenty of others, mostly geared towards blogs. I also had success with docfx and MkDocs, both for project documentation.


Yep. I'm well versed with static site generators but every one I've ever worked with has been heavily template based rather than being an actual layout engine that map onto HTML+CSS+SVG. i.e. They all require you to still write in HTML+CSS+SVG rather than being a generalised way of writing HTML+CSS+SVG without dealing with the warts of those languages.


I don't entirely get what you mean by "layout engine". A WYSIWYG editor perhaps? Or maybe a canvas like Microsoft OneNote, where you can draw and put text boxes? Or a word processor? Why isn't the usual Markdown (or the like) approach enough?

My gut feeling is that you cannot (fully) abstract away HTML/CSS if you want the result to feel like an actual website.

With Astro, MkDocs or docfx, I do not have to touch HTML, except maybe for creating the master layout and/or transformation rules, if needed.


> Why isn't the usual Markdown (or the like) approach enough?

Because you can't use markdown to design CSS or SVG animations. I want to be able to design an animation with code that describes how the elements move/interact and then compile that down into CSS or SVG keyframes so that I don't have to manually declare however many arbitrarily complex keyframes.

I understand the purpose of a static site generator and I'm not looking for anything to replace that. Rather I want to be able to write the templates for my static sites without 1. writing exceptionally tedious HTML & CSS and without 2. relying on client side JS to do those tedious things.


I think HTML+CSS is already a pretty good layout engine, so people don't really bother. In fact I think it's so good it's used even when it really shouldn't be, like with Electron applications.


astro is a modern framework "optimised for content heavy websites" i.e. vanilla assets mostly except when asked for something more.

[1] https://astro.build/


There are. It is not necessary faster/more optimized approach.


not sure what you mean, but htmx might be what you are looking for?


You are not sure what they meant, yet you think you know what they are looking for?


I am not sure this dice will roll less than six, but I think it will.


I am not sure what you meant, but I am sure there is a function with an infinite number of possibilities that it is really relatable to something.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: