Last active
December 19, 2025 16:41
-
-
Save ifthenelse/18cf30d480a3866eaed8677785454ad9 to your computer and use it in GitHub Desktop.
Terser options for bookmarklets
This file contains hidden or 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
| { | |
| module: false, // bookmarklets are usually classic scripts, not ESM | |
| parse: { | |
| ecma: 2020 | |
| }, | |
| compress: { | |
| ecma: 2020, | |
| passes: 2, | |
| dead_code: true, | |
| drop_debugger: true, | |
| evaluate: true, | |
| inline: 2, | |
| loops: true, | |
| conditionals: true, | |
| booleans: true, | |
| sequences: true, | |
| comparisons: true, | |
| reduce_funcs: true, | |
| reduce_vars: true, | |
| collapse_vars: true, | |
| // IMPORTANT for bookmarklets: | |
| toplevel: false, | |
| // usually keep console logs during dev; flip to true for release | |
| drop_console: false | |
| }, | |
| mangle: { | |
| // IMPORTANT for bookmarklets: | |
| toplevel: false, | |
| // don't mangle property names in injected scripts | |
| properties: false | |
| }, | |
| output: { | |
| ecma: 2020, | |
| comments: false, | |
| ascii_only: true, | |
| wrap_iife: true // keeps things self-contained (bookmarklet-friendly) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment