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 = { coffee: 'client/scripts/**/*.coffee', lib: 'client/lib/**/*.js', images: 'client/img/**/*' }; gulp.task('coffee', function(){ return gulp.src(paths.coffee) .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('lib', function(){ return gulp.src(paths.lib) .pipe(sourcemaps.init()) .pipe(concat('lib.min.js')) .pipe(sourcemaps.write()) .pipe(gulp.dest('static')) }); gulp.task('default', [ 'coffee', 'lib' ]);