https://github.com/vbauer/lein-coffeescript.git
git clone 'https://github.com/vbauer/lein-coffeescript.git'
(ql:quickload :vbauer.lein-coffeescript)
CoffeeScript is a little language that compiles into JavaScript. Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.
The golden rule of CoffeeScript is: “It's just JavaScript”. The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly from CoffeeScript (and vice-versa). The compiled output is readable and pretty-printed, will work in every JavaScript runtime, and tends to run as fast or faster than the equivalent handwritten JavaScript.
lein-coffeescript is a Leiningen plugin that allows to use CoffeeScript compiler.
Install NodeJS and NPM (package manager for Node) to install CoffeeScript:
sudo apt-get install nodejs
brew install node
Install CoffeeScript to use lein-coffeescript plugin. It could be done in few ways:
npm install coffee-script -g
npm install coffee-script
lein npm install
lein deps
To enable lein-coffeescript for your project, put the following in the :plugins vector of your project.clj file:
; Use latest version instead of "X.X.X"
:plugins [[lein-coffeescript "X.X.X"]]
To configure lein-coffeescript, put the :coffeescript parameter in the file project.clj. It could be a single configuration (simple map) or a collection of configurations (for multiple configuration).
; single configuration
:coffeescript {:sources "src/*.cs"}
; multiple configurations
:coffeescript [{:sources "src/*.cs"
:bare false
:map true}
{:sources ["src/*.coffee" "resources/*.cs"]
:bare true}]
sourceMappingURL
directives to the JavaScript as well. Default value: false.To enable this plugin in the compile stage, use the following hook:
clojure
:hooks [lein-coffeescript.plugin]
:coffeescript {:sources "resources/*.coffee"
:excludes ["resources/tests.coffee" "resources/bad.coffee"]
:map true
:join "app.js"
:output "target/js"
:bare false
:debug true}
Just clone the current repository and try to play with example project for better understanding how to use lein-coffeescript.
To compile CoffeeScript files using configuration from project.clj, you should use: lein coffeescript
To show help: lein help coffeescript
To run unit tests:
lein test
CoffeeScript author Jeremy Ashkenas and other developers who worked on this great project.
Copyright © 2014 Vladislav Bauer
Distributed under the Eclipse Public License, the same as Clojure.