Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to run a coffee-script project in cloud 9

I've been contemplating moving my project over to cloud 9 IDE but have been having trouble running coffee script in the project. I copied over all my js and coffee files but can't seem to get a run configuration working using the coffee files. I tried compiling the coffee files in the console command line as well as creating a run configuration that calls the app.coffee directly but no luck.

What is the coffee script support on cloud 9 and how does it work. Does it compile the coffee script to js automatically? How do I need to configure my run settings in cloud 9?

like image 779
MonkeyBonkey Avatar asked Nov 02 '11 12:11

MonkeyBonkey


People also ask

What is CoffeeScript written in?

CoffeeScript is a programming language that compiles to JavaScript. It adds syntactic sugar inspired by Ruby, Python, and Haskell in an effort to enhance JavaScript's brevity and readability. Specific additional features include list comprehension and destructuring assignment.


2 Answers

I got it working... your results may vary, but this is what I did...

Assuming you have your app which is called app.coffee, I created a file called runner.js with the following code:

require("coffee-script");
require("./app");

From the Cloud9 IDE, I just tell it to run the runner.js file and it seems to work.

I also wasn't able to use my global npm-installed packages... not sure why, but I am guessing it is just a pathing issue. Anyways, I just installed my packages into my project directory:

npm install coffee-script

I was also using express and restler in my project so I did the same thing in the project. It worked beautiffuly :)

like image 158
Brian Genisio Avatar answered Oct 15 '22 14:10

Brian Genisio


There is an entry on the Cloud9 support page on running node.js applications written in CoffeeScript: Create a CoffeeScript node.js project. Note that you can only debug the javascript files.

like image 39
Jan Jongboom Avatar answered Oct 15 '22 13:10

Jan Jongboom