6 ms·
Yeah, I was not at ease with this kind of stuff but I more and more like it. I'm hesitating between using a fully XML compliant code to be able to automaticall
by jraph 3y ago
Yeah, I was not at ease with this kind of stuff but I more and more like it.
I'm hesitating between using a fully XML compliant code to be able to automatically spot stupid mistakes thanks to the parser, or this. If I'm not validating the XML I don't see much point in writing these extra tags. It's just less data to transfer. Compression is a thing but still.
I do see one point: the version with the extra tags is closer to the actual representation of the document in the browser. You have to explain to newcomers that a full DOM with html, head and body elements will be rendered even if they are not present in the source code, with consequences for CSS and JavaScript to style and manipulate the document. The speech is just easier when the source matches the DOM.
For the missing tag endings, it requires quite deeper knowledge about parsing HTML to read a document. It's clear that it makes taking notes faster, but the code is perhaps less clear to someone who has not read it. Still a bit hesitant on this.
Nitpick: you might need <meta charset=utf8> before the title.
- afiori 3y agoA good minimizer for the html could remove the optional tags
- jraph 3y agoYep, that would be a solution for any project which has a build pipeline (anyway). For the better or the worse, when I deal with HTML directly, I usually just copy the HTML pages as they are on the server and have no mandatory Javascript, if at all. It's easier, and it's also "free backup on production".
- nicbou 3y agoAre there specific ones you recommend? Currently I just use CloudFlare's, but I'd love to squeeze a few extra kb out of my static pages.
- marcosdumay 3y agoI do think a maximizer that fills the optional tags in would be more useful. (Yeah, that's called a pretty printer, but the symmetry is nice.)
- abathur 3y agoIf an extra tool is fine, a really common trope in the world of minimal markup languages/libraries/DSLs are ways to write low-furniture html/xml and generate the delivery files. DMark (https://denisdefreyne.github.io/d-mark/ https://denisdefreyne.github.io/d-mark/) is the only one I've used, but IIRC there are probably ~dozens of these out there (and many eschew furniture more than DMark).
- jraph 3y agoI didn't know about DMark. I actually designed a syntax that provides a way to implement custom tags, but this is not quite easy. While my syntax is even lighter than this, it's reasonable and DMark seems to be very easy and enjoyable to extend. And I say this as someone who doesn't know Ruby and for whom Ruby hasn't clicked (yet?). I'll definitely have to check it out, either to adopt it or to improve my own thing, ten years later. Thanks for mentioning it, there's taste in this design. Very nice.
- abathur 3y agoIt is. I found it several years back but I finally built something on it recently and extending it was pretty simple (as someone who likewise doesn't know ruby, though I've written a little for Chef recipes). I ended up writing a python parser for it (mainly just to get access to a different css parser), and the author also has a rust parser.
- sebazzz 3y ago> Yeah, I was not at ease with this kind of stuff but I more and more like it. Found the person omitting semicolons in Javascript ;-)
- jraph 3y agoAh :-P Yeah, it would make sense. I didn't like semicolon omission at first, actually now I still prefer with the semicolons and I believe ASI was a mistake, but I mostly don't care.