News for hackers. Stuff that matters.
Re:Astro framework lowers competitors by ~40% on performance... by foobarbecue on Wednesday July 05, 2023 @11:17AM (#36601603)
Yes, it's awful that HTML is now dependent on js... how did we let that happen?? I'm thinking mostly of HTML5 web components, which, unless I missed something, are completely useless without js. All I wanted was a way for HTML to import other HTML. This seems to be the central issue that we've been hacking around for decades with SSI, template languages, and js. It's so basic -- everybody wants a header and a footer and maybe a menu on each page. Should be an HTML feature.
Re:Astro framework lowers competitors by ~40% on performance... by gochi on Wednesday July 05, 2023 @11:40AM (#36601970)
You're basically suggesting implementing JS within HTML, which htmx exists on a technicality, but not sure that's something we should be pushing at all. We're just spreading JS problems to HTML which is a perfectly fine language.
Re:Astro framework lowers competitors by ~40% on performance... by bobthepanda on Wednesday July 05, 2023 @12:14PM (#36602564)
Also, JSX is pretty much literally this.

But yes, HTML was clearly designed for producing output markup; but in reality the people who want to generate markup want to handle nested data, if/else, and loops, because that is better than copy pasting a bunch of markup everywhere and occasionally fat-fingering something.

Re:Astro framework lowers competitors by ~40% on performance... by johnmw on Wednesday July 05, 2023 @05:31PM (#36607451)
I'm not sure I follow? I think the GP was just talking about the ability to import other HTML fragments without JS? Something like:

  <fragment href="site-menu.html"/>
Which would load my shared site wide menu html into the parent div.

I'm not sure why JS would be needed here? (i.e in the same way html <select> elements are interactive without needing "JS").

Going a little more out there, what about cross domain imports for easy web component consumption?

  <fragment href="https://weather-widget.org?location=london" />
I can't see how this would be less secure than current cross domain JS imports?

It used to be sorta possible with HTML Imports but that spec got dropped [1].

[1] https://www.w3.org/TR/html-imports/

Re:Astro framework lowers competitors by ~40% on performance... by mrpf1ster on Wednesday July 05, 2023 @07:20PM (#36608623)
Is this not just an iframe?
Re:Astro framework lowers competitors by ~40% on performance... by wruza on Wednesday July 05, 2023 @08:55PM (#36609495)
Iframes are opaque for css, form fields and for js in some sense.
Re:Astro framework lowers competitors by ~40% on performance... by teaearlgraycold on Wednesday July 05, 2023 @11:39AM (#36601947)
iframes?
Re:Astro framework lowers competitors by ~40% on performance... by otabdeveloper4 on Wednesday July 05, 2023 @11:51AM (#36602183)
Yes, except without the frame. (Restrict cross-origin requests if you worry about security.)
Re:Astro framework lowers competitors by ~40% on performance... by bilekas on Wednesday July 05, 2023 @01:10PM (#36603486)
Are iframes still fully supported across all browsers though?
Re:Astro framework lowers competitors by ~40% on performance... by slmjkdbtl on Wednesday July 05, 2023 @12:14PM (#36602544)
You can just make a function that generates HTML string like

    h("div", { class: "container" }, [
        h("p", {}, "oh hi!"),
        ...projects.map(renderProject),
    ])
the end result will have no JS if all you want is reuse HTML parts, much better than template languages imo (no additional syntax, has loops / functions / variables out of the box)
Re:Astro framework lowers competitors by ~40% on performance... by rado on Wednesday July 05, 2023 @12:20PM (#36602638)
Declarative web components with Shadow DOM are now supported everywhere and require no JS.
Re:Astro framework lowers competitors by ~40% on performance... by spankalee on Wednesday July 05, 2023 @12:32PM (#36602816)
That's not true. Declarative shadow DOM is supported in Safari, Chrome, and Edge, but that is not the same as declarative custom elements, which don't have a spec yet.
Re:Astro framework lowers competitors by ~40% on performance... by foobarbecue on Wednesday July 05, 2023 @01:44PM (#36604063)
Fantastic. Thanks for telling me about this.
Re:Astro framework lowers competitors by ~40% on performance... by spankalee on Wednesday July 05, 2023 @12:33PM (#36602839)
Web components are custom HTML elements, which typically combine state behavior and state-based rendering. How do you expect to do that without JS, at least without porting a non-trivial subset of a JS-like programming language into HTML?
Re:Astro framework lowers competitors by ~40% on performance... by lenkite on Wednesday July 05, 2023 @12:40PM (#36602951)
Once upon a time we had HTML Imports which were lovely. But it made browser vendors nervous since folks could do stuff without Javascript. And what would then happen to all their tracking ? So, they unanimously purged the feature.

    <link rel="import" href="/partials/browser-vendors-hate-this.html" />
Re:Astro framework lowers competitors by ~40% on performance... by youngtaff on Wednesday July 05, 2023 @03:02PM (#36605450)
The problem with imports is they were render blocking

Don’t need JS to do tracking, and browsers can track without needs any marketing tags at all

Re:Astro framework lowers competitors by ~40% on performance... by lenkite on Thursday July 06, 2023 @04:14AM (#36612813)
Not a big deal. There are already render blocking resources today. Could be ameliorated with an async attribute if needed.

Obviously browsers that directly track users will lead a stinking public cloud and litigation. Vendors prefer their customers do the tracking for them. And make the ecosystem unable to function without tracking.

Re:Astro framework lowers competitors by ~40% on performance... by lyjackal on Wednesday July 05, 2023 @01:53PM (#36604243)
For what it’s worth, Astro is a static site generator that only relies on JavaScript at build time, and has optional integration with the usual js frameworks. In many ways that’s what it does solve (just importing html)