Skip to content

Ability to exclude files from deletion after zipping. #368

@zekageri

Description

@zekageri

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.
}),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions