As an experiment, I decided to try this out. I was thinking the other day it would be nice if I could upload a coffeescript file to our CMS at work, and have it generate a corresponding JS file that I can refer to in the views. This is actually pretty straight forward if you have NodeJS installed.

The NodeJS installer also comes with the NPM package manager, which you can use to install CoffeeScript:

npm install -g coffee-script

The most important thing here is to take note of where the binary for coffeescript sits. I used the where command to figure this out:

where coffee

Then all you need is to create a commandline C# project in visual studio, and use the Process class:

That will output the compiled coffeescript using standard out. You can of course store it into a string and use a StreamWriter to store it into a file, like I want to do. To grab the output, you will need to use a StringBuilder, and a loop as such to grab all the content.