Fixed gulpfile not cleaning temp-files

This commit is contained in:
Tobias Reich 2014-11-02 00:08:47 +01:00
parent a54dd628cf
commit f0c078d62f

View File

@ -33,29 +33,38 @@ paths.view = {
gulp.task('view--js', function() { gulp.task('view--js', function() {
return gulp.src(paths.view.js) var stream =
.pipe(plugins.concat('_view--javascript.js', {newLine: "\n"})) gulp.src(paths.view.js)
.pipe(gulp.dest('../dist/')); .pipe(plugins.concat('_view--javascript.js', {newLine: "\n"}))
.pipe(gulp.dest('../dist/'));
return stream;
}); });
gulp.task('view--coffee', function() { gulp.task('view--coffee', function() {
return gulp.src(paths.view.coffee) var stream =
.pipe(plugins.coffee({bare: true})) gulp.src(paths.view.coffee)
.on('error', catchError) .pipe(plugins.coffee({bare: true}))
.pipe(plugins.concat('_view--coffee.js', {newLine: "\n"})) .on('error', catchError)
.pipe(gulp.dest('../dist/')); .pipe(plugins.concat('_view--coffee.js', {newLine: "\n"}))
.pipe(gulp.dest('../dist/'));
return stream;
}); });
gulp.task('view--scripts', ['view--js', 'view--coffee'], function() { gulp.task('view--scripts', ['view--js', 'view--coffee'], function() {
return gulp.src(paths.view.scripts) var stream =
.pipe(plugins.concat('view.js', {newLine: "\n"})) gulp.src(paths.view.scripts)
.pipe(plugins.uglify()) .pipe(plugins.concat('view.js', {newLine: "\n"}))
.on('error', catchError) .pipe(plugins.uglify())
.pipe(gulp.dest('../dist/')); .on('error', catchError)
.pipe(gulp.dest('../dist/'));
return stream;
}); });
@ -88,41 +97,53 @@ paths.main = {
gulp.task('main--js', function() { gulp.task('main--js', function() {
return gulp.src(paths.main.js) var stream =
.pipe(plugins.concat('_main--javascript.js', {newLine: "\n"})) gulp.src(paths.main.js)
.pipe(gulp.dest('../dist/')); .pipe(plugins.concat('_main--javascript.js', {newLine: "\n"}))
.pipe(gulp.dest('../dist/'));
return stream;
}); });
gulp.task('main--coffee', function() { gulp.task('main--coffee', function() {
return gulp.src(paths.main.coffee) var stream =
.pipe(plugins.coffee({bare: true})) gulp.src(paths.main.coffee)
.on('error', catchError) .pipe(plugins.coffee({bare: true}))
.pipe(plugins.concat('_main--coffee.js', {newLine: "\n"})) .on('error', catchError)
.pipe(gulp.dest('../dist/')); .pipe(plugins.concat('_main--coffee.js', {newLine: "\n"}))
.pipe(gulp.dest('../dist/'));
return stream;
}); });
gulp.task('main--scripts', ['main--js', 'main--coffee'], function() { gulp.task('main--scripts', ['main--js', 'main--coffee'], function() {
return gulp.src(paths.main.scripts) var stream =
.pipe(plugins.concat('main.js', {newLine: "\n"})) gulp.src(paths.main.scripts)
.pipe(plugins.uglify()) .pipe(plugins.concat('main.js', {newLine: "\n"}))
.on('error', catchError) .pipe(plugins.uglify())
.pipe(gulp.dest('../dist/')); .on('error', catchError)
.pipe(gulp.dest('../dist/'));
return stream;
}); });
gulp.task('main--styles', function() { gulp.task('main--styles', function() {
return gulp.src(paths.main.styles) var stream =
.pipe(plugins.sass()) gulp.src(paths.main.styles)
.on('error', catchError) .pipe(plugins.sass())
.pipe(plugins.concat('main.css', {newLine: "\n"})) .on('error', catchError)
.pipe(plugins.autoprefixer('last 4 versions', '> 5%')) .pipe(plugins.concat('main.css', {newLine: "\n"}))
.pipe(plugins.minifyCss()) .pipe(plugins.autoprefixer('last 4 versions', '> 5%'))
.pipe(gulp.dest('../dist/')); .pipe(plugins.minifyCss())
.pipe(gulp.dest('../dist/'));
return stream;
}); });
@ -130,15 +151,22 @@ gulp.task('main--styles', function() {
gulp.task('clean', function() { gulp.task('clean', function() {
return gulp.src('../dist/_*.*', { read: false }) var stream =
.pipe(plugins.rimraf({ force: true })) gulp.src('../dist/_*.*', { read: false })
.on('error', catchError); .pipe(plugins.rimraf({ force: true }))
.on('error', catchError);
return stream;
}); });
/* Tasks ----------------------------------------- */ /* Tasks ----------------------------------------- */
gulp.task('default', ['view--scripts', 'main--scripts', 'main--styles', 'clean']); gulp.task('default', ['view--scripts', 'main--scripts', 'main--styles'], function() {
gulp.start('clean');
});
gulp.task('watch', ['default'], function() { gulp.task('watch', ['default'], function() {