Clearwater, a front-end app framework in Ruby

I wonder if a templating engine would be more likely to encourage developers to build too large components.

I’d like to chat about this with you sometime. The Slim->React compiler I tried before was a lot harder than I expected — I couldn’t figure out a way to get Temple to get commas in between outputs.

One benefit of keeping dependencies out of the Component mixin is that people will be able to build on top of it or replace it with something that fits their development style. As long as the object responds to render and returns virtual DOM nodes, you can use it (there are two additional attr_accessors needed on routed components, but that’s it). I’m going to try my best not to let Clearwater assume much (if any) more about components. I like that simplicity.

I’m not sure how I feel about separating templates and components. After using React for a while, I really do like the cohesion of the component with its output. Switching back and forth between the two files in my editor feels like unnecessary context switches now. I’m not sure yet if that’s laziness, but I admit it feels nice to have it all in one place.

Clearwater actually used the template approach originally. I liked the idea behind opal-haml, so I wrote the opal-slim gem (based on opal-haml) so I could use Slim templates instead. It blew my mind that it was possible, and I’d be glad to support the existence of gems that allow that in Clearwater, but I don’t think I want it inside Clearwater itself.

1 Like

me too~

On the whole brackets/templating issue I like to use the gem arbre

html = Arbre::Context.new do
  h2 "Why is Arbre awesome?"

  ul do
    li "The DOM is implemented in ruby"
    li "You can create object oriented views"
    li "Templates suck"
  end
end

puts html.to_s # =>
<h2>Why is Arbre awesome?</h2>
<ul>
  <li>The DOM is implemented in ruby</li>
  <li>You can create object oriented views</li>
  <li>Templates suck</li>
</ul>

I haven’t tried this with Clearwater but with Ruby being Ruby I imagine it wouldn’t be hard to disable the existing HTML code gen code and just use arbre.


UPDATE

After watching a bit of the video Aston posted I see the code it has generates DOM nodes rather than HTML. :frowning:

1 Like

You will not regret using ember with your Rails app . Ror and node.js both scales very well with ember but i would prefer node if its a small to medium sized application while rails for large application.
Its completely upto your style to choose from rails or node .