Chris F.
Chris F.

Reputation: 501

How to Add Coffeescript to Node.js Skeleton Framework?

Skeleton (https://github.com/dstroot/skeleton) seems to be a very solid "framework" for node.js, and has all the middleware that I am looking for except coffee script. How can I possibly add it to my project?

I set up a gulp.task in gulpfile.js which is looking for the coffee scripts to compile into javascript but where do these compiled files go? And how will they be used after they are compiled into *.js?

gulp.task('coffee', function ()

Initially I will have both javascript and coffee.

Any help would be much appreciated!

Upvotes: 0

Views: 194

Answers (1)

Preview
Preview

Reputation: 35806

Well since all the .js files are in the controller folder (except the test ones), you could create a gulp coffee task which could be something like this :

gulp.task('coffee', function () {
  return gulp.src('./controllers/*.coffee')
    .pipe(coffee())
    .pipe(gulp.dest('./controllers/'));
}):

Your coffee files will be in the same folder as the js one, but you can change that as you prefer.

You will have to change the scripts task a bit to add the coffee as dependency :

gulp.task('scripts', ['coffee'], function () {

Also remove the js watcher to replace it by the coffee.

Upvotes: 1

Related Questions