Skip to content
Gem for ClojureScript on Rails Asset Pipeline
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



Clementine is a gem to use ClojureScript ( from Ruby. Clementine is a Tilt ( Template, which is available to use on Rails asset pipeline. Also, it is avilable to use in a Tilt way. You don't need to compile ClojureScript by yourself anymore. Clementine does for you.

Clementine runs on Rails 3.1 and later.

Clementine supports JRuby and CRuby. When you use from CRuby, make sure java command is on your PATH.

Please be aware. When you run Clementine on CRuby, you hook up JVM everytime ClojureScript code is changed. This takes long time since starting JVM is a heavy weight job. For a shorter compilation time, I recommend using JRuby.


gem install clementine

While installing this gem, you'll see a confusing phrase, "Installing clementine (version string) with native extensions." This means clementine is bootstrapping ClojureScript. Clementine never relies on any C library.


Create clementine.rb file in your ${Rails.root}/config/initializer directory.


Clementine.options[:optimizations] = :whitespace
Clementine.options[:pretty_print] = true

Available options:

  KEY                VALUES                  DEFAULT
  ------------------ ----------------------- -------------------
  :optimizations     :whitespace, :advanced  :advanced
  :pretty_print      false, true             false
  :target            :nodejs                 (none)
  :output_dir        directory name          (none)
  :output_to         file name               (none)

If you want to see a readable JavaScript code on the browser, set :whitespace for :optimazations and true for :pretty_print in ${Rails.root}/config/initializer/clementine.rb like the example above.

ClojureScript has :none value for :optimizations, which also works with Clementine. However, there's no way to see the output with Rails asset pipeline. So, I didn't add :none in the above table.

Copyright and License

Clementine is Copyright (c) 2011-2012 Yoko Harada and distributed under the MIT license.

Clojure and ClojureSript are Copyright (c) Rich Hickey and covered by the Eclipse Public License 1.0

Google Closure Compiler and Library are covered by Apache License 2.0.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.