Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Created July 28, 2011 16:53
Show Gist options
  • Select an option

  • Save brianleroux/1111936 to your computer and use it in GitHub Desktop.

Select an option

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

sintaxi commented Jul 28, 2011

Copy link
Copy Markdown

+1 for compile ceremony before git push. sorry.

@brianleroux

Copy link
Copy Markdown
Author

nooooo! it makes the src tree so fucking fugly!

@alunny

alunny commented Jul 28, 2011

Copy link
Copy Markdown

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
Copy Markdown
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

sintaxi commented Jul 28, 2011

Copy link
Copy Markdown

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

@brianleroux

Copy link
Copy Markdown
Author

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

@isaacs

isaacs commented Jul 28, 2011

Copy link
Copy Markdown

Why not just do this?

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

@sintaxi

sintaxi commented Jul 28, 2011

Copy link
Copy Markdown

@brianleroux I think you found your answer :)

@brianleroux

Copy link
Copy Markdown
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