0.1.0 • Published 9 years ago
laravel-webpack-cleanup-plugin v0.1.0
laravel-webpack-cleanup-plugin
This webpack plugin cleans up the extraneous files from the webpack's output path.
Since it runs when the compile process is finished, it is useful when building on production to remove the assets created by previous builds.
npm i -SD laravel-webpack-cleanup-plugin⚠️ Beware! This plugins actually delete files. Make sure it's safe for your app
to delete files not generated by webpack. Use the exclude option if you want to
keep files that are not webpack assets.
Usage
Install via npm:
npm i -SD laravel-webpack-cleanup-pluginThen add the plugin to the plugins array in your webpack's config, e.g.:
// webpack.config.js
import LaravelWebpackCleanupPlugin from 'laravel-webpack-cleanup-plugin';
const config = {
output: {
path: "/my/output/path" // absolute path
},
// ...
plugins: [
new LaravelWebpackCleanupPlugin('build/assets/js')
]
}
export default config;Options
- Specify the manifest.json file.
// Default manifest file "assets/build/rev-manifest.json"
new LaravelWebpackCleanupPlugin('build/assets/js', {
manifest: 'assets/build/rev-manifest.json',
})- If you want to keep some files in the output path, e.g. a
stats.jsonfile generated from some other plugins.
// Do not delete `stats.json`, `important.json`, and everything in `folder`
new LaravelWebpackCleanupPlugin('build/assets/js', {
exclude: ["stats.json", "important.js"],
})- To mute the console output, use the
quietoption:
new LaravelWebpackCleanupPlugin('build/assets/js', {
quiet: true,
})- To print the list of the files that will be deleted without actually deleting them, use the
previewoption:
new LaravelWebpackCleanupPlugin('build/assets/js', {
preview: true,
})0.1.0
9 years ago