Using coffeescript with kanso

The Automatic Way

Add coffee-script-precompiler to your dependencies in kanso.json.

"dependencies": {
        "coffee-script-precompiler": null

Add a coffee-script field to kanso.json with one or both of the following: a list of folders to search for coffeescript modules and a list of folders to search for coffeescript attachments.

"coffee-script": {
    "modules": ["lib", "tests"],
    "attachments": ["js"]

Run kanso install from your terminal to install dependencies. When you kanso push:

  1. All coffeescript modules listed in coffee-script.modules will be compiled to javascript and uploaded as usual.
  2. All coffeescript files in attachements directories will be uploaded as attachments at the corrosponding path with a .js extension. So /lib/js/ will be uploaded to /lib/js/main.js.

The Manual Way

Good for package development where you don't intend to directly kanso push your app.


Install Guard and Guard Coffeescript.


Put this in a Guardfile at the root of your project.

guard 'coffeescript', :output => 'lib', :bare => true do


Start Guard by (in a terminal) running guard in your project's root directory.

Write your Coffeescript files in the src directory of the root of your project. Guard watches for changes and generates javascript source files in the lib directory of the root of your project.


Guard will only generate javascript files when they are changed. To generate javascript for all documents in the src directory every time you start guard add :all_on_start => true to your Guardfile. It will look like this.

guard 'coffeescript', :output => 'lib', :bare => true, :all_on_start => true do