java-script:minification-uglification
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| java-script:minification-uglification [2023/08/09 16:48] – odefta | java-script:minification-uglification [2025/01/02 18:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 16: | Line 16: | ||
| Minify a file: | Minify a file: | ||
| < | < | ||
| - | npx terser file.js -o file.min.js | + | terser file.js -o file.min.js |
| </ | </ | ||
| Line 27: | Line 27: | ||
| Install it: | Install it: | ||
| < | < | ||
| - | npm install uglify-js | + | npm install uglify-js |
| </ | </ | ||
| Uglify a file using both **compression (-c)** and name **mangling (-m)**: | Uglify a file using both **compression (-c)** and name **mangling (-m)**: | ||
| < | < | ||
| - | npx uglifyjs file.js -o file.min.js -c -m | + | uglifyjs file.js -o file.min.js -c -m |
| </ | </ | ||
| Line 49: | Line 49: | ||
| </ | </ | ||
| + | <note top> | ||
| + | Terser is a more recent tool and is often recommended for modern JavaScript, as it supports newer syntax features that UglifyJS might not handle. | ||
| + | </ | ||
| - | + | <note tip> | |
| - | + | Most modern web development workflows incorporate these processes into a build system like **[[https:// | |
| + | </ | ||
java-script/minification-uglification.1691599713.txt.gz · Last modified: (external edit)
