From 34a3172297bc41b83468126c9888d937c62c59e7 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..b91bb38 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) }