webpack-contrib / compression-webpack-plugin

Prepare compressed versions of assets to serve them with Content-Encoding
MIT License
1.41k stars 108 forks source link

Let users exclude files or folder from deleting original assets. #366

Closed zekageri closed 1 year ago

zekageri commented 1 year ago

I want to delete all original assets except my Image folder because Iam working on a microcontroller and I can't parse zipped images. I need a way to keep the zipped versions of my images as well as the original ones.

zekageri commented 1 year ago

Something like this

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
    excludeFromDelete: "Images/**/*"
}),