Daniel D
Daniel D

Reputation: 3677

Where should cake generated js files from a coffeescript node app go?

I'm using coffeescript while writing a node js app and use cake watch to compile my js files real time.

That's great to be able to do that - but where should I stick those js files? Right now, I'm saving them right next to their respective coffeescript files, but that just feels awkward...

Upvotes: 1

Views: 209

Answers (1)

Jared Hanson
Jared Hanson

Reputation: 16000

The convention I've gotten comfortable with is to put CoffeeScript files in a src directory and have "compiled" JavaScript output to a lib directory. Like so:

package.json
lib/mymodule.js
src/mymodule.coffee

If you publish the module to the npm registry, you can just include the resulting lib directory, which is conventionally where projects written in JavaScript keep there .js files. This keeps everything consistent.

Upvotes: 3

Related Questions