Hey everyone, we’re pushing Clearwater toward 1.0 and I’ve added a roadmap to indicate the features we’re currently tracking to get us there. I think it’s got what a 1.0 front-end framework needs: routing, rendering, and the app wrapper to manage it all.
It allows for very complex apps, but also includes optimizations for small apps. For example, this is all you need to get started in Rails:
# Gemfile
gem 'clearwater'
gem 'opal-rails' # For asset-pipeline stuff
# app/assets/application.rb
require 'opal'
require 'clearwater'
class Layout
include Clearwater::Component
def render
h1('Hello, world!')
end
end
Clearwater::Application.new(component: Layout.new).call
Then you just need a root route to render a blank page and you’re all set.
I haven’t included application state management because there are so many ways to do it and I don’t think it’s a solved problem yet in the front-end-Ruby ecosystem. I’ve written the grand_central
gem, which is a Redux-like state container, and I personally love using it. I think it’s even better in Ruby than Redux is in JavaScript. The downside is that the larger Ruby community isn’t about immutability, which GrandCentral encourages heavily (as does Redux), so I’ll be recommending GrandCentral for now, but I think at this point it’s best to let an app developer choose their state-management solution.
The documentation does need a lot of help, as well. Initially, I’ve been thinking of using the project wiki as the docs, but I’d also like to get a dedicated documentation site going. I was thinking of writing topics for:
- Quick start with Rails
- Components
- Styling with Ruby
- Adding routes
- Managing app state within components
- Managing app state with GrandCentral
- Communicating with an API
- Testing your app with RSpec
- Using actual DOM nodes in your app
If you’d like to contribute, you can let me know by responding to this thread, tweeting at me, submitting a PR to the Clearwater repo, or chat with me in the gitter channel. Thanks so much!