Re:Bringing functional to the frontend – Clojure and Clojure...
by aria on Thursday January 17, 2013 @02:01PM
(#5074440)
The nice thing about dommy (github.com/prismatic/dommy) is that emacs doesn't need to be changed at all to use it. It's just clojure and all the highlighting and the emacs major mode work.
Also out of the box, you get a repl to live test and evaluate template functions and data structure. It would only take a few lines of emacs lisp to take a string from the repl and pipe it through XHTML validation.
Re:Bringing functional to the frontend – Clojure and Clojure...
by ibdknox on Thursday January 17, 2013 @02:35PM
(#5074679)
In terms of performance, wouldn't it be far faster to use strings and turn those into document fragments or setting innerHTML? I've been looking at ways to make crate much faster and it seems that would be the fastest solution by far.
Re:Bringing functional to the frontend – Clojure and Clojure...
by zcam on Thursday January 17, 2013 @03:10PM
(#5074897)
That's the approach Hiccups took, it goes as far as generating most of the html at compile time as well.
I didn't run benchmarks but I would guess it is faster than crate in some situations (huge fragments, older browsers etc).
Another plus is nodejs compatibilty (if you care about that, but I guess you might :)).
Re:Bringing functional to the frontend – Clojure and Clojure...
by mark_l_watson on Thursday January 17, 2013 @04:31PM
(#5075346)
The Community Edition (free) of IntellJ with the Clojure plugin will help you here: I get immediate error highlighting when editing Hiccup code in my Clojure view files - recommended!
A little off topic, but I have been using Emacs to edit Lisp code since the early 1980s, but IMHO IntellJ with the Clojure plugin is a bit more efficient for writing and reading code.
One of the thing that I love when developing under Emacs is that I can get real-time validation of my XML (eg XHTML) based on, say Relax NG. This even works nicely with multiple-major-mode (eg I can get realtime validation of the XML part, yet see JavaScript as JavaScript inside the same source file).
Now my question: with all these templating libraries like Jade, aren't you losing feature like real-time validation?
And when such a templating library comes out, it means every editor out there as to be modified so that it supports it?
Or is there some kind of a schema that can be used to perform real-time validation + auto-completion?
My point is: I definitely see the point as replacing Jade by Clojure because you can then manipulate your templates as data, which is gorgeous. But I don't see the point of using Jade in the first place...