I have this test.html
file that contains:
<div class="clj-test class1 class2 col-sm-4 class3">content</div>
A want to define a template that changes only a part of an html attr value:
(deftemplate test "public/templates/test.html" []
[:.clj-test] (enlive/set-attr :class (partly-change-attr #"col*" "col-sm-8")))
This would render:
...
<div class="clj-test class1 class2 col-sm-8 class3">content</div>
...
Thanks for your help!
Just found the
update-attr
fn suggested by Christophe Grand in another thread:Pretty cool! We can use it directly :
Or build from it a more specific fn: