Jiew Meng
Jiew Meng

Reputation: 88197

Possible to write ExpressJS/Node applications with CoffeeScript without compiling? Like connect-assets for Server

I could use connect-assets to write CoffeeScript and Stylus (CSS) files without compiling and it will do the rest. Is it possible for the server side too? I could write my start my "CoffeeScript" server like:

coffee server.coffee

But I don't think it knows how to interprete CoffeeScript files directly. Is it possible to use purely CoffeeScript? Else, how what is your workflow and folder structure like? I dont want to have coffees and jss all mixed up

Upvotes: 2

Views: 571

Answers (2)

Matěj Koubík
Matěj Koubík

Reputation: 1147

Rewrite your application to application.coffee, then write this to your app.js:

require('coffee-script');
module.exports = require('./application.coffee');

Then node app.js will run your server. Off course you have to install coffee-script.

Upvotes: 3

Pickels
Pickels

Reputation: 34630

You can just start your server the way you described it. No need to compile it.

coffee app.coffee

Upvotes: 2

Related Questions