Languages
[Edit]
EN

JavaScript - compress js files with terser (supports ES6+)

5 points
Created by:
troya
332

In this short article, we would like to show how to use terser to compile js files to minified versions (*.min.js).

Quick solution (run following command):

cat input.js | npx terser --compress --mangle > output.min.js

Terser advantages:

  • has support for ES6+,
  • effective compression.

 

Installation

We can install terser globally using:

npm install -g terser

 

References

  1. https://github.com/terser/terser

Web resources compression / minify (JS, CSS)

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join