gulp plugin to delete matched file based on RegExp Obj
npm install gulp-delete-filegulp-delete-file as a development dependency:
```
npm install --save gulp-delete-filegulp-delete-file
Then, create task using , which might look similar as below:
`
'use strict';
var gulp = require('gulp'),
deletefile = require('gulp-delete-file');
gulp.task('deletefile', function () {
var regexp = /\w(\-\w{8}\.js){1}$|\w(\-\w{8}\.css){1}$/;
gulp.src(['./build/public/train/*/.js',
'./build/public/train/*/.css',
'./build/public/train/*/.scss',
'./build/public/train/*/.less'
]).pipe(deletefile({
reg: regexp,
deleteMatch: false
}))
});
`
Finally, fire gulp task:
`
gulp deletefile
`reg$3
:is a RegExp Object
deleteMatch:if the value is 'true',then the command will delete all the files which match the reg-rule. if it is 'false',then delete all the files which doesn't match the reg-rule.
``
├── _common
│ ├── bridge
│ ├── hybrid
│ ├── icons
│ ├── msg-f90a9a3d.js
│ ├── msg.js
│ ├── train-487d2c1f.css
│ ├── train-count-ad175de1.js
│ ├── train-count.js
│ ├── train.css
│ ├── train.scss
│ ├── utils-e3a5c9fc.js
│ ├── utils.js
│ └── vendors
```
├── _common
│ ├── bridge
│ ├── hybrid
│ ├── icons
│ ├── msg-f90a9a3d.js
│ ├── train-487d2c1f.css
│ ├── train-count-ad175de1.js
│ ├── utils-e3a5c9fc.js
│ └── vendors