5 ms·
I have used Enlive and I still prefer traditional erb style templates. I actually use Slim(slim > haml) or Haml, but they are just syntactic sugar. Enlive, on
by irahul 14y ago
I have used Enlive and I still prefer traditional erb style templates. I actually use Slim(slim > haml) or Haml, but they are just syntactic sugar.
Enlive, on one hand, allows designers to work on html which doesn't need any data binding, and then process the plain html. On the other hand, it's tightly coupled with the markup. A designer can't be sure that changing a class name or restructuring the markup won't break the templates.
Rolling your own validations might be fun, or it isn't something I want to do when I am working on a project. I might have rolled out validations from last project which I can re-use, but I still prefer AR or WTForm validation over rolling my own(takes time, and if I am in a hurry, ends up not being generic enough to use in another project). Same goes for pagination. Need pagination? Here,
# Add kaminari https://github.com/amatsuda/kaminari
class UsersController
def index
@users = User.order(:name).page params[:page]
end
end
# index.html.slim
= paginate @users
Done.
Clojure is a pleasant, expressive and innovative language, but as the blog post pointed out, the ecosystem isn't vibrant enough yet.
- asmala 14y agoComing from Rails, I tend to agree that the Clojure ecosystem is still less mature, but not by as much as I initially thought. Missing Rails I18n, SimpleForm, or validations? Clojure has you covered: * https://github.com/ptaoussanis/tower https://github.com/ptaoussanis/tower * https://github.com/asmala/clj-simple-form https://github.com/asmala/clj-simple-form * http://clojurevalidations.info/ http://clojurevalidations.info/ Need more specialized libraries? Take a look at ClojureWerkz: * http://clojurewerkz.org/ http://clojurewerkz.org/ Having tried hard to understand the rather labyrinthine source of the original SimpleForm library, I was astonished by how easy Clojure made writing a similar library, clj-simple-form. The key contributing factors were Clojure's emphasis on simple data structures and powerful functions as opposed to classes, and the ability to pass around functions just like any other objects. For a lot of projects, I find ease of extensibility to be more important than ready libraries.
- kinleyd 14y agoClojure does make difficult things easy. And it's getting better and better with the rapid evolution of new libraries and middleware. Given one of the core differences in approach, composibility for Clojure and 'convention over configuration' for RoR - I don't think there will ever be a monolithic RoR equivalent in Clojure. Instead the micro-frameworks that are emerging are finding their niches, and are being designed from the ground up to work with other micro-frameworks. Working in tandem these compositions of micro-frameworks are quickly getting mature and I'm sure will be in the same league as RoR soon enough. What I like about this is it allows you to handle Clojure a micro-framework or middleware at a time. It's easier to digest this way, at least for me: Ring -> Compojure -> Hiccup - Enlive/Comb/Fleet [x] -> Korma -> Friend, followed by Domina, Enfocus and others on the ClojureScript side. [x]: marks where I am.
- kinleyd 14y agoI forgot to add to [x]: noir, lein-cljsbuild and clojurescript one; and to the ClojureScript side: jayq, fetch, waltz and crate.