Guard::CoffeeScript compiles you CoffeeScripts automatically when files are modified. It is tested on Ruby 1.8.7 & 1.9.2.
Please be sure to have Guard installed before continue.
Install the gem:
gem install guard-coffeescript
Add it to your
Gemfile, preferably inside the development group:
Add guard definition to your
Guardfile by running this command:
guard init coffeescript
The json library is also required but is not explicitly stated as a gem dependency. If you're on Ruby 1.8 you'll need to install the json or json_pure gem. On Ruby 1.9, json is included in the standard library.
Please refer to the CoffeeScript documentation for more information about how to install the latest CoffeeScript version on node.js.
To use CoffeeScript on V8, simple add
therubyracer to your Gemfile. The Ruby Racer acts as a bridge between Ruby
and the V8 engine, that will be automatically installed by the Ruby Racer.
group :development do gem 'therubyracer' end
If you're using JRuby, you can embed the Mozilla Rhino runtime by adding
therubyrhino to your Gemfile:
group :development do gem 'therubyrhino' end
Microsoft Windows Script Host
Microsoft Windows Script Host is available on any Microsoft Windows operating systems.
Please read the Guard usage documentation.
Guard::CoffeeScript can be adapted to all kind of projects. Please read the Guard documentation for more information about the Guardfile DSL.
In addition to the standard configuration, this Guard has a short notation for configure projects with a single input a output
directory. This notation creates a watcher from the
:input parameter that matches all CoffeeScript files under the given directory
and you don't have to specify a watch regular expression.
Standard ruby gem
There following options can be passed to Guard::CoffeeScript:
The guard detects by default nested directories and creates these within the output directory. The detection is based on the match of the watch regular expression:
that has been detected by the watch
with an output directory of
will be compiled to
Note the parenthesis around the
.+\.coffee. This enables Guard::CoffeeScript to place the full path that was matched inside the
parenthesis into the proper output directory.
This behaviour can be switched off by passing the option
directly to the output directory.
Multiple source directories
The Guard short notation
will be internally converted into the standard notation by adding
(.+\.coffee) to the
input option string and create a Watcher
that is equivalent to:
To add a second source directory that will be compiled to the same output directory, just add another watcher:
which is equivalent to:
Pull requests are very welcome! Make sure your patches are well tested.
The Guard Team for giving us such a nice pice of software that is so easy to extend, one has to make a plugin for it!
All the authors of the numerous Guards available for making the Guard ecosystem so much growing and comprehensive.
(The MIT License)
Copyright (c) 2010 - 2011 Michael Kessler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.