Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Created July 28, 2011 16:53
Show Gist options
  • Save brianleroux/1111936 to your computer and use it in GitHub Desktop.
Save brianleroux/1111936 to your computer and use it in GitHub Desktop.
pls make this better
// seems the coffee method run is the way to go but I was using it wrong (I think)
require('fs').readFile('app.coffee', function(err, code) {
// anyhow, this works but is certianly not ideal
eval(require('coffee-script').compile(code.toString('utf8')))
})
// also: I do *not* want a compile ceremony leaving .js detritus all over my project if possible!
@sintaxi
Copy link

sintaxi commented Jul 28, 2011

+1 for compile ceremony before git push. sorry.

@brianleroux
Copy link
Author

nooooo! it makes the src tree so fucking fugly!

@alunny
Copy link

alunny commented Jul 28, 2011

Why don't you just write server.js in coffeescript? In my limited experience, if you wanna use coffeescript, you should use it for all your js files in a single project.

@brianleroux
Copy link
Author

cuz the place(s) I'm deploying doesn't support the coffee cmd unless I provision their servers which I'd prefer to avoid --- I'm being laaaazy

@sintaxi
Copy link

sintaxi commented Jul 28, 2011

I think a strong case could be made for node platforms to do this for you :)

@brianleroux
Copy link
Author

the case is all in the nasty snippet above! =)

@isaacs
Copy link

isaacs commented Jul 28, 2011

Why not just do this?

require("coffee-script")
require("./server.coffee")

@sintaxi
Copy link

sintaxi commented Jul 28, 2011

@brianleroux I think you found your answer :)

@brianleroux
Copy link
Author

Holy webscale batman! I had no idea coffeescript could be required into node after it had been required in. Thx @izs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment