Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, number>()
Expand Down Expand Up @@ -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)
}
Expand Down