rollup-plugin-gzip icon indicating copy to clipboard operation
rollup-plugin-gzip copied to clipboard

Option for custom destination

Open peopledrivemecrazy opened this issue 5 years ago • 1 comments

It would be great to have another option for choosing anoter destination than the source directory.

peopledrivemecrazy avatar Sep 25 '20 09:09 peopledrivemecrazy

I'm very sorry, I must have totally overlooked this issue!

Should this not already be possible through passing a function as fileName option?

gzipPlugin({
    fileName: name => `compressed/${name}.gz`,
}),

When specifying additionalFiles, there might be some kind of switch necessary as their name will be relative to the root directory while rollup's bundle file names will be relative to the target directory:

gzipPlugin({
    additionalFiles: ['dist/foo.css'],
    fileName: name =>
        name.startsWith('dist')
            ? `dist/compressed/${path.basename(name)}.gz`
            : `compressed/${name}.gz`,
}),

kryops avatar May 08 '21 05:05 kryops