Remove files created in the last run but not anymore in the current one.
In development environment, build process are run once a file change detected. If a file is removed, the corresponding compiled file (like a browserify bundle) remains, which is redundant and should be deleted.
The following example make the
'build' directory always has the same contents with the
const gulp =const clean =gulpgulp
You could delete the whole
'build' directory in the example above.
However, if you do that and there are also css files in the
they will be deleted against your will.
const Clean =
clean = Clean(initialFiles)
Return a function like a gulp plugin,
which should be used after
If there are no redundant files before the first run, you could pass an empty array.
const gulp =const clean =
clean = Clean.glob(patterns, opts)
opts are passed to [
globby] to create the