awesome-webpack
awesome-webpack copied to clipboard
Add remove-files-webpack-plugin
remove-files-webpack-plugin is a flexible plugin that removes files and folders before and after compilation.
Features
- removing before and after compilation ("watch" mode is supported).
- removing in trash.
- removing outside the root.
- before removing folders and files are checked for safety (i.e. if removing of folder/file is unsafe, then it will be not removed).
- emulating of remove process.
- flexible test system.
- customizable log system.
- pretty output.
Examples
new RemovePlugin({
/**
* Before compilation permanently removes
* entire `./dist` folder.
*/
before: {
include: [
'./dist'
]
}
})
new RemovePlugin({
/**
* After compilation removes in trash
* all maps files in `./dist/styles` folder and
* all subfolders (e.g. `./dist/styles/header`).
*/
after: {
test: [
{
folder: 'dist/styles',
method: (absoluteItemPath) => {
return new RegExp(/\.map$/, 'm').test(absoluteItemPath);
},
recursive: true
}
],
trash: true
}
})
Pretty output
Please see source readme for detailed description and examples.