On Wed, Sep 1, 2010 at 5:32 PM, Sean Corfield <seancorfi...@gmail.com>wrote:

> On Wed, Sep 1, 2010 at 1:26 PM, Saul Hazledine <shaz...@gmail.com> wrote:
> > A good tutorial can be found at:
> > http://github.com/swannodette/enlive-tutorial
>
> It was that tutorial that made me not want to use Enlive. Having *all*
> the code completely outside the template means a lot of extra work
>

I can only speak from my own experience but only in the most trivial cases
is it more work. However very complex templates become trivial with Enlive.
It's also not too difficult to write macros to automatically generate Enlive
templates from the markup itself to eliminate any tedium.


> wiring up even the simplest stuff. It's also very fragile: changes to
> the HTML can easily break the external templating code and the
> designer would have no idea they might break it because there's no
> visual clue in the HTML.


I find this to be the case with existing templating solutions as well. Plus
it's far more common in my experience for the code to break the template and
for the designer to sit around and twiddle his/her thumbs while the coders
fix the problem. In anycase, this is nothing that conventions, communication
and version control can't solve.


> There's no doubt that Enlive's very clever
> and powerful, but I wouldn't want to build web sites with it.
>

Fair enough.


> The other thing that concerns me about that Enlive tutorial is that a
> template needs to be applied to each HTML page to create a function
> and that function used in the route definitions. That means that
> adding a new page to the site touches multiple files which is not very
> DRY.


I may be misunderstanding, but nope. Templates and snippets are generated at
compile time, not run time, they only touch a file once - when you compile
your program. Template are more like layouts really, pages are composed of a
layout (template) and a series of snippets. They don't need to be in the
route either, I just did that to keep things simple.

While Enlive has it problems (not enough friendly error reporting about
structural issues in the template, missing HTML files, etc.), I think it's
pretty great leap forward for HTML templating.

David

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to