Jamie Gaskins

Ruby/Rails developer, coffee addict

Clearwater Playground: Play with Ruby in the Browser

Published Dec 28, 2016

I've just published Clearwater Playground, a place to play around with the Clearwater framework with as little friction as possible.

It's still very young (as in, less than 24 hours), so it's not a full JSBin or CodePen or anything (none of them that I know of support compiling Ruby->JS or I'd just use them, tbh, because they're already amazing), but it will at least show you how certain things work with Clearwater.

It starts out like you'd see in JSBin or CodePen (though with not nearly as much thought put into the design), however instead of JavaScript, you enter Ruby code. There is a JavaScript pane, but it's only generated code — the output of the Opal compiler. It compiles on the fly inside the browser, which is why the JS payload is the size it is; it actually contains the compiler, itself compiled from Ruby into JS.

Yo, dawg, I heard you like compiling Ruby into JavaScript, so we compiled the Ruby-to-JavaScript compiler from Ruby to JavaScript so you can compile Ruby into JavaScript while you write Ruby in a JavaScript environment.

Yeah, I know, that joke was the worst thing since the Jump to Conclusions mat.

Coming Soon

This is definitely not a finished project yet. Some upcoming features I've got planned are:

  • Persisting apps for demoing to others — much more useful than copy/pasting from gists
  • Better code-editor panes
  • Console output pane
  • A better/more efficient app-execution strategy — it currently reloads the entire Opal runtime, Clearwater framework, and all other dependencies on every execution
  • First-load performance — might CDN the assets

Feel free to experiment with Ruby on the front end with Clearwater! I've published the source code on GitHub, so feel free to send bug reports, feature requests, or pull requests. I'm really enjoying using Clearwater for front-end development and I hope you'll enjoy it, too!