If you ask me markup is code. Therefore you are trying to split what can and should be one into two, with one thing even using an entirely different language.
Why replace anything? Why not just generate what you want in the first place? Without having a separate thing that you need to replace?
Yes, many designers probably don’t want to touch hiccup/clojure. But I can still take their HTML and just copy&paste the part I’m working on into Cursive. It’ll convert that to hiccup for me automatically.
I have also tried the “completely static HTML template” approach before, but it always failed as soon as you add even basic logic. Say you want to create a form that displays error messages and puts an “error” class and message somewhere. So, the HTML either shows no errors by default, or errors that you then need to “remove” in code. Often there are more than error true?/false?
conditions, ie. a cond/case
with 5 branches In the end the templates I get from designers never look anything like the final template needs to. At least never did for me.
Say you build some shop website listing 3 products next to each other. The HTML I get from my designers, if I even get any, has three dummy products. I take one div
and
(defn html-products [products]
[:div.products
(for [{:keys [title]} products]
[:div.product [:div.product-title title] ...])])
or something like that. Very precise and everything where it should be.
With the HTML approach I now have to first find the correct selector, delete unwanted elements, delete/add unused classes, add conditional elements, splice text. All this while looking at two separate files with one being in super verbose gibberish syntax.
If I have to edit the files I get some designers anyways, I know which route I’m taking. Also note that and changes to the “template” HTML, even if done by designers, will likely often mean you need to touch the code modifiying it again anyways. So, I’d rather do it directly, even that means I’m the one doing the edits. Using CSS classnames/ids to “target” specific elements, ie. jquery style, is also a terrible pattern that needs to die quick death, but again IMHO, YMMV.