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