Skip to content

Commit 49048f8

Browse files
committed
improve(build): replaced deprecated plugin gulp-rimraf with del
1 parent 37cff86 commit 49048f8

2 files changed

Lines changed: 8 additions & 13 deletions

File tree

gulpfile.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
var gulp = require('gulp'),
44
map = require('map-stream'),
5+
del = require('del'),
56
plugins = require('gulp-load-plugins')(),
67
server = require('tiny-lr')(),
78
config = require('./config.json'),
@@ -278,9 +279,7 @@ gulp.task('watch', ['styles:sass', 'scripts:lint', 'scripts:cacheTpls', 'assets:
278279
gulp.watch(config.paths.scripts, function (event) {
279280
if (event.path.lastIndexOf('.js') === event.path.length - 3) {
280281
if (event.type === 'deleted') {
281-
var buildPath = event.path.replace(config.app, config.build);
282-
return gulp.src(buildPath, { read: false })
283-
.pipe(plugins.rimraf());
282+
del(event.path.replace(config.app, config.build));
284283
} else {
285284
return fnLint(event.path).pipe(plugins.livereload(server));
286285
}
@@ -312,9 +311,7 @@ gulp.task('watch', ['styles:sass', 'scripts:lint', 'scripts:cacheTpls', 'assets:
312311

313312
gulp.watch(config.paths.assets, function (event) {
314313
if (event.type === 'deleted') {
315-
var buildPath = event.path.replace(config.app, config.build);
316-
return gulp.src(buildPath, { read: false })
317-
.pipe(plugins.rimraf());
314+
del(event.path.replace(config.app, config.build));
318315
} else {
319316
return fnImg(event.path).pipe(plugins.livereload(server));
320317
}
@@ -330,13 +327,11 @@ gulp.task('watch', ['styles:sass', 'scripts:lint', 'scripts:cacheTpls', 'assets:
330327
// Clean up development & production directories
331328
// =============================================
332329

333-
gulp.task('clean:build', function () {
334-
return gulp.src(config.build, { read: false })
335-
.pipe(plugins.rimraf());
330+
gulp.task('clean:build', function (cb) {
331+
del(config.build, cb);
336332
});
337-
gulp.task('clean:compile', function () {
338-
return gulp.src(config.dist, { read: false })
339-
.pipe(plugins.rimraf({ force: true }));
333+
gulp.task('clean:compile', function (cb) {
334+
del(config.dist, { force: true }, cb);
340335
});
341336

342337

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"connect": "^2.21.0",
1111
"connect-livereload": "^0.4.0",
1212
"connect-modrewrite": "^0.7.6",
13+
"del": "^0.1.3",
1314
"express": "^3.12.0",
1415
"gulp": "^3.8.2",
1516
"gulp-angular-templatecache": "^1.2.1",
@@ -31,7 +32,6 @@
3132
"gulp-ng-annotate": "^0.3.3",
3233
"gulp-plumber": "^0.6.3",
3334
"gulp-rename": "^1.2.0",
34-
"gulp-rimraf": "^0.1.0",
3535
"gulp-sass": "=0.7.1",
3636
"gulp-size": "^0.3.1",
3737
"gulp-uglify": "^0.3.1",

0 commit comments

Comments
 (0)