Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Minimalist build system for CoffeeScript.
JavaScript CoffeeScript Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Coffee Toaster

Essential build tool for working with complex inheritance architecture using CoffeeScript.

CoffeeToaster adds support for inheritance between multiple CoffeeScript source files, it lets you split everything into modules and automagically resolves all your 'extends' or declared dependencies, compiling every module into a single Javascript file.

Every CoffeeScript file is merged with the proper order before being compiled to Java Script.

You can have one or many classes per file, it doesn't matter, CoffeeToaster will gently handle everything for you.


npm install -g coffee-toaster


Creating a new App

CoffeeToaster suggests a very simple structure for initial projects, you can customize it as you like.

toaster new mynewapp

You will be asked for some things:

  1. name - The name of your main module.
    • i.e.: mynewapp
  2. src - The source folder for your main module
    • i.e.: src
  3. release - The release file for your main module
    • i.e.: release/app.js

Your scructure will be create with a '' file inside it.

Toasting an existing project

Your can toast an existent project like this:

cd existing-project


toaster existing-project

The same questions (name, src, release) will be made, answer everything according your project structure.

A '' file will be created inside it.

When the magic happens

To see all CoffeeToaster can do for you, after creating or toasting a new project, enter in the project folder and type 'toaster':

cd existing-project


toaster existing-project

How everything works?

CoffeeToaster will write a file called '' in your app main folder.

Config File (

This file contains informations about the modules you have in your app, i.e:

modules = 
    name: "My Awesome App"
    src: "src"
    release: "release/app.js"

So you when you call 'toaster' inside this directory, every file and folder start being watched.

Every time something changes, CoffeeToaster re-compiles all your application by doing:

  • merges all *.coffee file into a single string buffer
  • split all classes into arrays
  • re-order everything so classes are defined always before they are needed.

Wait! How the hell it know when classes are needed?

Extends directive

Every time you use 'class A extends B', CoffeeToaster reads the dependency -- "B" in this case -- and put it B before A, automagically.

Of course, there must to be some file with the 'class B' declared inside of it, in your src folder.

Import directive

The import directive is known by '#<< ClassName' or '#<< ClassNameA, ClassNameB'.

By putting '#<< ClassNameA' in your CoffeeScript file, you're telling CoffeeToaster about a dependency.

Dependencies required in this method will be placed after the 'extended' one.

For example, let's assume you have three files:

#<< C
class A extends B
        console.log "C created"
        console.log new C

class B
    constructor:-> console.log "B created"

class C
    constructor:-> console.log "C created"

This way, everything will be merged in an order like this:


class B
    constructor:-> console.log "B created"
class C
    constructor:-> console.log "C created"
class A extends B
        console.log "C created"
        console.log new C

Output (JavaScript)

The output JavaScript compiled after reordering classes will be something like this:

(function() {
  var A, B, C;
  var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
    for (var key in parent) { if (, key)) child[key] = parent[key]; }
    function ctor() { this.constructor = child; }
    ctor.prototype = parent.prototype;
    child.prototype = new ctor;
    child.__super__ = parent.prototype;
    return child;
  B = (function() {
    function B() {
      console.log("B created");
    return B;
  C = (function() {
    function C() {
      console.log("C created");
    return C;
  A = (function() {
    __extends(A, B);
    function A() {
      console.log("C created");
      console.log(new C);
    return A;

As you can see, things are ordered properly, then you can have your application's tree all tied up with a single start point.

Multiple Modules

You can also specify multiple modules lilke:

modules = [
        name: "My Awesome App"
        src: "src"
        release: "release/app.js"
        name: "My Sub Awesome App"
        src: "vendors/mysubapp"
        release: "release/subapp.js"

Mailing List

A place to talk about it.

Something went wrong with that request. Please try again.