Looking for an HTML preprocessor

I will be honest, I assumed this would be super easy to find, but alas it is not. What I am effectively looking for is an HTML preprocessor to take something that is less verbose than HTML and give me HTML, because writing HTML by hand is a pain. I don’t want dynamic pages (so I am not interested in variables or for loops or any of that stuff), and I don’t want to need to spin up a whole JavaScript script just to compile some static pages (looking at you Pug). Is there any tool where I can have foo.ext and just do compile foo.ext >foo.html?
12 Replies
Mango Man
Mango Man11mo ago
Also I am pretty opposed to something like Markdown, because I want to have actual control over the HTML structure
b1mind
b1mind11mo ago
personally, I'd go for SvelteKit for most things. But Astro is a good option these days too. I use Pug quite often for simple stuff but I used to use it lots more and its template is nice imo. the way it does blocks and extends is 🔥 I've heard good things about Nunjucks too. https://pugjs.org/api/getting-started.html https://mozilla.github.io/nunjucks/ Svelte template syntax is very similar to Handlebars I think 🤔 oh funny also next time maybe drop this kinda post in #discussions I thought that is were I was looking xD
Mango Man
Mango Man11mo ago
I don’t want dynamic pages (so I am not interested in variables or for loops or any of that stuff), and I don’t want to need to spin up a whole JavaScript script just to compile some static pages (looking at you Pug).
I guess if I wasn’t so clear, I want something that makes writing HTML easier (like Pug), but without the stupid need to have to write a JavaScript compilation script and stuff
b1mind
b1mind11mo ago
...
Mango Man
Mango Man11mo ago
I am working on my own thing for this, but I’ve been slacking a good bit
b1mind
b1mind11mo ago
You will need to use a preprocessor.. You can look at Gulp and stuff but imo that is just way worse than using npm/bundlers Either way you need the libs to do it and a watch script or something else looking at the files to compile
Mango Man
Mango Man11mo ago
I don’t really need a watch script and stuff I basically want to just write HTML by hand, but hate HTML syntax
b1mind
b1mind11mo ago
... I gave you 3 great options xD Pug life is very nice 😉
b1mind
b1mind11mo ago
I mean or just learn to use VIM motions (tags work well with it) and b1mindPunkhttps://docs.emmet.io/cheat-sheet/
Mango Man
Mango Man11mo ago
I mean I’d like to think my Vim-fu is very good and I’ve got something similar to emmet going for me on emacs but html still sucks to touch, who designed this garbage think
“The essence of XML is this: the problem it solves is not hard, and it does not solve the problem well.” — Phil Wadler
b1mind
b1mind11mo ago
I mean it is what it is mate honestly if your vim-fu is good you should be using some cit cat dit dat ci" ysat % around xD Really not that bad to work with imo but then again like HTML >.>;; again though if I don't wanna work with html syntax I use pug (like making quick codepens, even though I have some limited vim motions there)