Code Monkey home page Code Monkey logo

clementine's Introduction

Clementine

Description

Clementine is a gem to use ClojureScript (https://github.com/clojure/clojurescript) from Ruby. Clementine is a Tilt (https://github.com/rtomayko/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.

Installation

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.

Configuration

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

Example:

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)

note
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.

note
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 http://opensource.org/licenses/eclipse-1.0.php

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

clementine's People

Contributors

flavorjones avatar yokolet avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.