RubyFlow The Ruby and Rails community linklog

Shaven - templating without mustaches!

Some time ago i’ve pushed working idea of totally logic-less templating system called shaven. It’s mix of tuned up presenter layer similar to defunkt’s mustache and neat, designers friendly, logic less html templates. Would be great to gather some feedback from you guys and push it to production!

Comments

Don’t know about you but rb:if=”true?” seems pretty damn like logic to me.

Adrian: I’ve decided to use this kind of “logic” after bunch of discussions with designers and views’ devs. Let say it straight, full elimination of logic from your views is or impossible, or will give you a lot of pain in the ass. This is imho good deal, friendly for both - designers and devs - at least better than plenty of sophisticated extras like mustaches, brackets, abstract syntax, etc etc. Btw, i consider support for html5 data attrs as alternative, but anyway… u can teach your designers to ignore this few extra things, and sometimes use rb:dummy and everyone is happy.

Btw, there is also second reason why i decided do it this way, unlike the most of ruby devs speed and efficiency matters for me… operation on explicit rb:* args is much much faster than applying data from the presenter side, eg using pseudo-decorators, etc.

I think logic is acceptable in views. My opinion is that if it is something that can be tested easily in a request test, then it is acceptable to put in the view.

Michael: mainly you’ve right, but in my case i usually receive ready html stuff from design studios or freelancers, and i’m not a frontend dev, so i don’t want to interfere in this code too much. Especially i don’t want to convert everything to abstracts like haml or slim. So far i was using mustache in my projects, but still influence into original templates was too big. Shaven so far is a concept, hope thanks to it i’ll get rid of my quirks.

I think logic is acceptable in views.

khuyen mai

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in