coffee-fast-compile

Module for fast compilation whole directories with very simple API

npm install coffee-fast-compile
10 downloads in the last week
20 downloads in the last month

coffee-fast-compile

There are situations when you start thinking for coffee-script support in you lib/module. But interface provided by official cooffee-script module is ugly and don't allow you to watch dir inside your script. This module is built to solve such problems providing simple interface for compiling and watching whole directories built on top nodejs streams.

build

It just compiles everything from example dir and outputs code to output dir saving all relatives paths.

compile = require('coffee-fast-compile');
var pipe = compile.build('example', 'output', function(files) {
  console.log(files, ' was compiled');
});

pipe.on('data', function(file) {
  if(file === 'compiled') {
    console.log('compiled');
  } else {
    console.log(file, ' compiled');
  }
});

watch

The same as build, but recompiles changed files on the fly. You also can use pipe to monitor results. When initially called, it invokes build, so first compilation can be long. While watching it only compiles changed files.

compile = require('coffee-fast-compile');
var pipe = compile.watch('example', 'output', function(files) {
  console.log(files, ' was compiled');
});
npm loves you