Reputation: 15846
How can i process a coffeescript code directly into javascript in node.js ?
maybe i could use the coffee compiler using child_process.exec/spawn/fork but is there a direct way ? like loading a library (that ships with the coffee package when it's installed with npm) and passing code to it, that returns the compiled code directly ?
Upvotes: 2
Views: 263
Reputation: 18258
You can do npm install coffee-script
and then just put var coffee = require('coffee-script');
to get access to the coffee.compile
function which will do what you want.
Upvotes: 4