Skip to content

Instantly share code, notes, and snippets.

@esamattis
Forked from pyykkis/james.js
Last active December 19, 2015 05:59
Show Gist options
  • Save esamattis/5908218 to your computer and use it in GitHub Desktop.
Save esamattis/5908218 to your computer and use it in GitHub Desktop.
// james-coffee/index.js
var james = require('james'),
coffee = require('coffee-script'),
fs = require("fs");
coffee.createStream = function() {
return james.createTransformation(function(content, callback) {
// Add header
fs.readFile("header.js", function(err, header) {
if (err) { // Where? }
cb(header.toString() + content);
});
});
};
james.read('./hello.coffee')
.transform(coffee.createStream)
.write(process.stdout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment