snowpack-plugin-optimize
Makes use of terser, csso, and html-minifier to provide minification of your JS, CSS, and HTML files
respectively.
Features
- Minify JS, CSS, and HTML assets
- SourceMap generation w/ remapping support
- Append
<link rel="modulepreload" />
tags to <head>
to speed up download of dependency tree. - TypeScript Declaration file output
- TypeScript Transformer Support
- TTypescript Support for custom compiler plugins
We're open to new kinds of optimizations, open an issue and lets talk!
Non-Features
- Bundling - If you're looking for that I'd definitely reccomend the official webpack plugin.
Install
npm i --save-dev snowpack-plugin-optimize
yarn add -d snowpack-plugin-optimize
Usage
module.exports = {
...config,
plugins: [
[
'snowpack-plugin-optimize',
{
minifyJs?: true
jsOptions?: {
module: true,
toplevel: true,
sourceMap: true,
nameCache,
compress: {
ecma: 2019,
},
format: {
ecma: 2019,
},
},
modulePreload?: true,
minifyCss?: true,
cssOptions?: {
sourceMap: true,
filename: path.basename(file),
},
minifyHtml?: true,
htmlOptions?: {
collapseWhitespace: true,
keepClosingSlash: true,
removeComments: true,
},
}
]
]
}