From 53a67974b31d8e028ae4ae16cabf2df95911be86 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 9 Nov 2021 18:17:31 +0200 Subject: [PATCH] feat: support for an output suffix which is appended to the compressed file name Fixes #12 --- src/plugin.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugin.ts b/src/plugin.ts index c47a1c0..8ab6a45 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -67,6 +67,10 @@ type PluginOptions = { * optionally `clean-css`. */ minifyHtml?: HtmlMinifyOptions | true + /** + * Suffix to add to compressed file instead of overwriting. + */ + outputSuffix?: string } const mtimeCache = new Map() @@ -274,6 +278,7 @@ export default (opts: PluginOptions = {}): Plugin[] => { await fsp.unlink(filePath) name = path.relative(outRoot, (filePath = newFilePath)) } + filePath += opts.outputSuffix || '' await fsp.writeFile(filePath, content) compressed.set(name, 1 - content.byteLength / oldSize) }