Skip to content

Instantly share code, notes, and snippets.

@steida
Created January 24, 2014 04:37
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save steida/8592161 to your computer and use it in GitHub Desktop.
Save steida/8592161 to your computer and use it in GitHub Desktop.
Gulp.js, keep the original folder structure, for side by side compilation.
var coffee = require('gulp-coffee');
var eventStream = require('event-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var scriptsDirs = [
'bower_components/este-library/este/',
'client/',
'server/'
];
gulp.task('coffee', function() {
var streams = scriptsDirs.map(function(dir) {
return gulp.src(dir + '**/*.coffee')
.pipe(coffee().on('error', gutil.log))
.pipe(gulp.dest(dir))
});
return eventStream.concat.apply(eventStream, streams);
});
@steida
Copy link
Author

steida commented Mar 30, 2014

Even better:

gulp.task 'coffee', ->
  gulp.src changedFile ? paths.coffee, 'base': '.'
    .pipe plumber()
    .pipe coffee bare: true
    .on 'error', (err) -> gutil.log err.message
    .pipe coffee2closure()
    .pipe gulp.dest '.'

@j03m
Copy link

j03m commented Jul 22, 2015

++ This was great thank you for posting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment