var gulp = require('gulp'); var sourcemaps = require('gulp-sourcemaps'); var coffee = require('gulp-coffee'); var insert = require('gulp-insert'); var uglify = require('gulp-uglify-es').default; var concat = require('gulp-concat'); var paths = { scripts: 'client/scripts/**/*.coffee', images: 'client/img/**/*' }; gulp.task('js', function(){ return gulp.src(paths.scripts) .pipe(sourcemaps.init()) .pipe(concat('app.min.js')) .pipe(coffee({bare: true})) .pipe(insert.transform(function(contents, file) { return '$(function () {' + contents + '});'; })) .pipe(uglify()) .pipe(sourcemaps.write()) .pipe(gulp.dest('static')) }); gulp.task('default', [ 'js' ]);