Created
April 19, 2011 08:02
-
-
Save aseemk/926995 to your computer and use it in GitHub Desktop.
A wrapper around streamline that supports require()-ing coffee files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('coffee-script'); | |
| require('./streamline'); | |
| function finish(err, res) { | |
| if (err) console.error(err); | |
| if (res) console.log(res); | |
| } | |
| require('./timeout_')(finish); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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