var gulp = require('gulp');
var uglify = require('gulp-uglify');
var gutil = require('gulp-util');
var gsourcemaps = require('gulp-sourcemaps');
gulp.task('build-sourcemap', function() {
gulp.src('./src/index.js')
.pipe(gsourcemaps.init())
.pipe(uglify())
.on('error', function(err) {
gutil.log(gutil.colors.red('[Error]'), err.toString());
})
.pipe(gsourcemaps.write('./'))
.pipe(gulp.dest('./dist'));
});
gulp.task('build', function() {
gulp.src('./src/index.js')
.pipe(uglify())
.on('error', function(err) {
gutil.log(gutil.colors.red('[Error]'), err.toString());
})
.pipe(gulp.dest('./dist'));
});