Skip to content

Instantly share code, notes, and snippets.

@YOzaz
Created April 21, 2015 15:27
Show Gist options
  • Save YOzaz/93770ecf09b7ac8f6f9b to your computer and use it in GitHub Desktop.
Save YOzaz/93770ecf09b7ac8f6f9b to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var ngAnnotate = require('gulp-ng-annotate');
var bytediff = require('gulp-bytediff');
var plumber = require('gulp-plumber');
var rename = require('gulp-rename');
gulp.task('app', function() {
return gulp.src(['public/app/**/ses.js', 'public/app/**/*.module.js', 'public/app/**/*.js'])
.pipe(plumber())
.pipe(concat('ses.js', {newLine: ';'}))
.pipe(ngAnnotate({add: true}))
.pipe(plumber.stop())
.pipe(gulp.dest('public/src/js/app/'));
});
gulp.task('prod', ['app'], function() {
return gulp.src('public/src/js/app/ses.js')
.pipe(plumber())
.pipe(bytediff.start())
.pipe(uglify({mangle: true}))
.pipe(bytediff.stop())
.pipe(rename('ses.min.js'))
.pipe(plumber.stop())
.pipe(gulp.dest('public/src/js/app/'));
});
gulp.task('watch', ['prod'], function () {
return gulp.watch('public/app/**/*.js', ['prod']);
});
gulp.task('default', ['watch', 'app']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment