Reputation: 4021
Looking for a way to produce an express scaffold in coffeescript straight off the bat.
At the moment $ express 'myapp'
just creates js files.
Any pointers will be appreciated. Thanks.
Upvotes: 0
Views: 1285
Reputation: 28111
After generating your express app and installing js2coffee, as previously mentioned, change directory to your new app and run:
for f in `find . -type f -path "*.js" ! -path "*node_modules*"`; js2coffee $f > "${f%.*}.coffee"
Upvotes: 0
Reputation: 56
You can transform the created app.js and routes/index.js files into coffeescript using js2coffee (like Slace stated)
There are two ways:
1. Manually using the js2coffee.org converter
2. Using the js2coffee
npm package and piping the output into a new file
$ cd my_new_express_app
$ sudo npm install js2coffee -g
Files can now be converted by running js2coffee input.js > output.coffee
$ js2coffee app.js > app.coffee
$ js2coffee routes/index.js > routes/index.coffee
This way you can start a fresh express project in coffeescript. Note that the conversion strips comments away.
Upvotes: 2
Reputation: 25099
Express only generates JavaScript from the scaffolding. You can use js2coffee to do the conversion yourself.
Upvotes: 1