Fork me on GitHub
#beginners
<
2015-09-05
>
vastor13:09:27

hey guys, what is the apparent difference between Enlive and Selmer?

jeffmk13:09:16

@vastor: Selmer is like Jinja2/Django templates, Enlive is HTML represented as Clojure vectors (`[:div [:a {:href “/“} “click me”]]`)

agile_geek14:09:10

@jeffmk isn’t it Hiccup that is html as vectors? Haven’t looked at these for months but from memory Selmer is a templating library that does placemarker replacement in html templates and Enlive actually pattern matches on selectors and ids in static HTML files and manipulates it to produce dynamic pages.

agile_geek14:09:01

Pragmatically it means Selmer templates need markup to indicate the dynamic elements whereas Enlive is raw HTML with no markup (unless you want it).

jeffmk14:09:27

@agile_geek @vastor Apologies, I had just woken and not had any caffeine 😐

jeffmk14:09:09

Looking at the github pages is useful to see context: https://github.com/cgrand/enlive https://github.com/yogthos/Selmer

agile_geek19:09:12

@jeffmk no problem. The way I think about the difference is that enlive lets designers work completely in static HTML without polluting it with markup. However, I’m not sure this is a big advantage as enlive is more sensitive to changes in Selectors/Ids that a designer would not think would have a side effect whereas markup in the HTML is explicit. Of course, enlive can do mark up too and gives a lot of flexibility to manipulate the shape of the page dynamically.

jeffmk20:09:30

Right, it’s about as sensitive to change as a webscraper I suppose. Ideally there'd be some kind of tests to catch that sort of thing, throw an error when a selector doesn't find its target.