Skip to content

Instantly share code, notes, and snippets.

@aseemk
Created July 6, 2011 23:39
Show Gist options
  • Save aseemk/1068606 to your computer and use it in GitHub Desktop.
Save aseemk/1068606 to your computer and use it in GitHub Desktop.
Handler for efficiently caching compiled Coffee and/or Streamline files.
// app-dev.js
// Helper script to register CoffeeScript and Streamline extension handlers
// before running an app during development.
//
// Uses https://github.com/aseemk/coffee-streamline for efficient require(),
// caching compiled files between runs. Sweet!
//
// Usage: instead of `_coffee app`, just do `node app-dev app`.
//
// Also works great w/ node-dev <https://github.com/fgnass/node-dev>:
// `node-dev app-dev app`.
var Path = require('path');
// remove this script from the node args:
process.argv.splice(1, 1);
// resolve the location of the main script:
var path = Path.resolve(process.cwd(), process.argv[1]);
// and run the target script as the main one:
require('coffee-streamline').run(path);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment