Last active
September 12, 2022 01:54
-
-
Save TransparentLC/57a1588159a19a097f3e2c8a358ef114 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/terser/html-minifier-terser#options-quick-reference | |
const htmlMinifierConfig = { | |
collapseWhitespace: true, | |
collapseBooleanAttributes: true, | |
decodeEntities: true, | |
removeComments: true, | |
removeRedundantAttributes: true, | |
removeScriptTypeAttributes: true, | |
removeStyleLinkTypeAttributes: true, | |
removeEmptyAttributes: true, | |
useShortDoctype: true, | |
sortAttributes: true, | |
sortClassName: true, | |
processConditionalComments: true, | |
minifyCSS: true, | |
minifyJS: true, | |
}; | |
// html-minifier-terser --collapse-whitespace --collapse-boolean-attributes --decode-entities --remove-comments --remove-redundant-attributes --remove-script-type-attributes --remove-style-link-type-attributes --remove-empty-attributes --use-short-doctype --sort-attributes --sort-class-name --process-conditional-comments --minify-css --minify-js --output output.html input.html | |
// https://terser.org/docs/api-reference | |
const terserConfig = { | |
compress: { | |
arguments: true, | |
ecma: 2020, | |
module: true, | |
unsafe_arrows: true, | |
unsafe_math: true, | |
unsafe_methods: true, | |
unsafe_proto: true, | |
unsafe_regexp: true, | |
unsafe_symbols: true, | |
unsafe_undefined: true, | |
passes: 2, | |
}, | |
mangle: { | |
module: true, | |
}, | |
format: { | |
ecma: 2020, | |
comments: false, | |
}, | |
}; | |
// terser --compress arguments,ecma=2020,module,unsafe_arrows,unsafe_math,unsafe_methods,unsafe_proto,unsafe_regexp,unsafe_symbols,unsafe_undefined,passes=2 --mangle module --format ecma=2020,comments=false --output output.js input.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment