This little Helper converts your .coffee files into .js without relying on Node.js or client-side parsing. Everything is compiled on the server, cached, and served as regular js through using the coffeescript-php compiler.
Clone from github: in your plugin directory type git clone https://github.com/Hyra/Coffee-Cake.git Coffee
You should end up having a folder app/Plugin/Coffee
- Create a folder called
coffee
inapp/webroot/
- Optionally apply
chmod 777
to yourjs
folder. (The Coffee Helper will place all compiled js files in your js-directory.)
Where you want to use Coffee files, add the helper. Usually this will be your AppController
.
public $helpers = array('Coffee.Coffee');
Next, simply add the Coffee files to your views:
echo $this->Coffee->script('yourfile');
or
echo $this->Coffee->script(array(
'somedir/somefile',
'awesome_script',
)
);
That's it.