9

All of the popular Clojure web frameworks I am seeing use hiccup to generate HTML. I find hiccup is hard to have a front end design person adjust to, compared to other frameworks that parse the syntax out of templates.

Is there a clojure web framework that doesn't require the front end developer to learn LISP?

Mantas Vidutis
  • 16,376
  • 20
  • 76
  • 92

5 Answers5

22

Check out Enlive. It will allow your designer to work in pure HTML.

Rayne
  • 31,473
  • 17
  • 86
  • 101
dnolen
  • 18,496
  • 4
  • 62
  • 71
14

Same Answer Plus Opinion

As other answers have already stated, Enlive will let you use pure HTML templates, while Hiccup leverages Clojure data structures to generate HTML.

But, as I think we'd all agree, HTML should be semantic and describe the structure of the page, while layout and look-and-feel should be left to CSS and JavaScript. At least out of my experience, front-end designers should not be responsible for drastically altering the structure of a page, but rather responsible for styling and placement through CSS and JavaScript.

Whenever working on an application more complex than a collection of static HTML pages, if a front-end designer feels the need to change a page's structure, that should be a joint conversation with the developer who put it together. With this in mind, the developer should choose a templating scheme or HTML generation method that allows him/her to be most productive. My two cents.

semperos
  • 4,674
  • 28
  • 31
  • do you mean you prefer Hiccup over Enlive ? – John Wang May 16 '13 at 06:19
  • 3
    Most of my Clojure web apps are solo, small projects. I almost always use Hiccup, because there's a relatively low barrier to remembering how to use it when I leave it and come back, whereas Enlive requires me to write markup in one file, Clojure to manipulate it in another, and to use custom functions with a CSS-like (but not CSS) query language to perform that manipulation. Enlive is a powerful tool, but when I'm prototyping a Clojure web app, Hiccup results in less mental overhead to getting things done for me personally. YMMV. – semperos May 16 '13 at 21:54
  • Now I get the differences on the taste of them. Thanks a lot for the clarification. – John Wang May 17 '13 at 01:24
4

Hiccup is mostly the default in examples, but all webframeworks I know of can work with any templating library.

Like dnolen mentioned there is Enlive which is quite popular (https://github.com/cgrand/enlive). Enlive has 100% separation of code and html. Very nice to use if you have other people doing the design.

Other then Hiccup and Enlive there is the lesser known fleet (https://github.com/Flamefork/fleet) which is closer to popular Ruby/PHP solutions.

Rayne
  • 31,473
  • 17
  • 86
  • 101
nickik
  • 5,809
  • 2
  • 29
  • 35
1

Three years later:

You can also have a look to Caribou http://let-caribou.in/ . It is a new Clojure framework that uses good old HTML syntax for templating.

You could start by watch this screencast: http://www.youtube.com/watch?v=dPUQ0GUvSt0

You'll see that you don't need to code in clojure for updating your data models either. Only the controllers (the links between templates and models) would require you to talk the lispy way...

Good luck!

leontalbot
  • 2,513
  • 1
  • 23
  • 32
1

There is also Selmer :

A fast, Django inspired template system in Clojure.

Which is therefore more suited to large apps.

nha
  • 17,623
  • 13
  • 87
  • 133