Skip to content

Instantly share code, notes, and snippets.

@aseemk
Created April 19, 2011 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aseemk/926995 to your computer and use it in GitHub Desktop.
Save aseemk/926995 to your computer and use it in GitHub Desktop.
A wrapper around streamline that supports require()-ing coffee files.
coffee = require 'coffee-script'
streamline = require 'streamline'
fs = require('fs')
if require.extensions
require.extensions['.coffee'] = (module, filename) ->
content = coffee.compile fs.readFileSync filename, 'utf8'
if filename.match /_\.coffee$/
content = streamline.transform.transform content
module._compile content, filename
require('coffee-script');
require('./streamline');
function finish(err, res) {
if (err) console.error(err);
if (res) console.log(res);
}
require('./timeout_')(finish);
module.exports = (_) ->
console.log Date.now()
setTimeout _, 2000
console.log Date.now()
return 'passed'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment