Skip to content

Commit 94bf558

Browse files
author
Nguyen Duc Huy
committed
Add windows support for clean task
1 parent 83a88fe commit 94bf558

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

gulpfile.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ var gulp = require('gulp'),
3939
cssmin = require('gulp-cssmin'),
4040
livereload = require('gulp-livereload'),
4141
gulpif = require('gulp-if'),
42-
colors = require('colors'),
42+
colors = require('colors'),
43+
clean = require('gulp-clean'),
4344
exec = require('child_process').exec;
4445

4546

@@ -208,13 +209,17 @@ gulp.task('cache-flush', function (cb) {
208209
// Clean static files cache
209210
gulp.task('clean', function (cb) {
210211
if (themeName) {
211-
exec('rm -rf var/cache var/view_preprocessed pub/static/' + themesConfig[themeName].area + '/' +
212-
themesConfig[themeName].name + '/',
213-
function (err, stdout, stderr) {
214-
console.log(stdout);
215-
console.log(stderr);
216-
cb(err);
217-
});
212+
var folders = [
213+
'var/cache',
214+
'var/view_preprocessed',
215+
'pub/static/' + themesConfig[themeName].area + '/' + themesConfig[themeName].name + '/'
216+
];
217+
218+
for (var i = 0; i < folders.length; i++) {
219+
console.log('Removing: ' + folders[i]);
220+
gulp.src(folders[i], {read: false})
221+
.pipe(clean());
222+
}
218223
}
219224

220225
else {

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@
1818
"gulp-livereload": "^3.8.1",
1919
"underscore": "^1.7.0",
2020
"colors": "^1.1.2"
21+
},
22+
"dependencies": {
23+
"gulp-clean": "^0.4.0"
2124
}
2225
}

0 commit comments

Comments
 (0)