logoalt Hacker News

jacoblambda11/08/20246 repliesview on HN

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?


Replies

vbezhenar11/08/2024

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.

show 1 reply
troupo11/08/2024

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

show 1 reply
fuzzy211/08/2024

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.

show 1 reply
tlarkworthy11/08/2024

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/

octacat11/08/2024

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

aaronblohowiak11/08/2024

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

show 1 reply