clean before build

This commit is contained in:
Aaron Jensen 2015-08-02 00:48:08 -07:00
parent bf482fc6a9
commit 49201f539a
2 changed files with 8 additions and 2 deletions

View File

@ -7,11 +7,16 @@ var nsp = require('gulp-nsp');
var babel = require('gulp-babel'); var babel = require('gulp-babel');
var watch = require('gulp-watch'); var watch = require('gulp-watch');
var batch = require('gulp-batch'); var batch = require('gulp-batch');
var rimraf = require('rimraf');
// Initialize the babel transpiler so ES2015 files gets compiled // Initialize the babel transpiler so ES2015 files gets compiled
// when they're loaded // when they're loaded
require('babel-core/register'); require('babel-core/register');
gulp.task('clean', function(cb) {
rimraf('./dist', cb);
});
gulp.task('static', function() { gulp.task('static', function() {
return gulp.src('**/*.js') return gulp.src('**/*.js')
.pipe(excludeGitignore()) .pipe(excludeGitignore())
@ -29,7 +34,7 @@ gulp.task('test', function() {
.pipe(mocha({reporter: 'spec'})); .pipe(mocha({reporter: 'spec'}));
}); });
gulp.task('babel', function() { gulp.task('babel', ['clean'], function() {
return gulp.src('lib/**/*.js') return gulp.src('lib/**/*.js')
.pipe(babel()) .pipe(babel())
.pipe(gulp.dest('dist')); .pipe(gulp.dest('dist'));

View File

@ -43,6 +43,7 @@
"gulp-mocha": "^2.0.0", "gulp-mocha": "^2.0.0",
"gulp-nsp": "^0.4.5", "gulp-nsp": "^0.4.5",
"gulp-watch": "^4.3.4", "gulp-watch": "^4.3.4",
"lodash": "^3.0.0" "lodash": "^3.0.0",
"rimraf": "^2.4.2"
} }
} }