Ability to exclude files from deletion after zipping.
zekageri opened this issue · 1 comments
zekageri commented
Right now if deleteOriginalAssets
is true, the plugin deletes all original files.
I want to exclude files from deletion.
Currently:
new CompressionPlugin({
filename: '[path][base].gz', // Use the .gz extension for compressed files
algorithm: 'gzip',
test: /\.(js|css|html|svg|json|...)$/, // Compress all types of files
minRatio: Infinity, // Compress all files, regardless of size
deleteOriginalAssets: true, // Delete the original uncompressed files
exclude: "Images" // Exclude whole Images folder but it will not zip them
}),
Feature request:
new CompressionPlugin({
filename: '[path][base].gz', // Use the .gz extension for compressed files
algorithm: 'gzip',
test: /\.(js|css|html|svg|json|...)$/, // Compress all types of files
minRatio: Infinity, // Compress all files, regardless of size
deleteOriginalAssets: true, // Delete the original uncompressed files
excludeFromDeletion: "Images" // Exclude whole Images folder from delete after zipping.
}),
alexander-akait commented
Do you want to send a PR, we can use:
deleteOriginalAssets: (filename) => {
return /name/.test(filename);
}