Skip to content

This project demonstrates how to use Terser for JavaScript minification. It provides examples of both simple code minification and file-based minification, showcasing how to minify JavaScript code using Terser.

License

Notifications You must be signed in to change notification settings

BaseMax/terser-demo

Repository files navigation

Terser Demo

This project demonstrates how to use Terser for JavaScript minification. It provides examples of both simple code minification and file-based minification, showcasing how to minify JavaScript code using Terser.

Installation

  1. Clone the repository:

    git clone https://github.com/BaseMax/terser-demo.git
  2. Install the dependencies:

    cd terser-demo
    npm install

Usage

Minifying Inline Code

In the code.js file, you can find an example of how to minify a block of JavaScript code using Terser. Run the script to see the minified version of the provided code.

Minifying Files

In the file.js file, there’s an example of how to read a JavaScript file (example-code.txt.js), minify it, and save the result to another file (example-code.js). This demonstrates how to use Terser for file-based minification.

Minifying Code with Source Maps

The test.js file shows how to minify JavaScript code while generating a source map. This can be useful for debugging and maintaining the connection between the minified code and the original source code.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright 2025, Max Base

About

This project demonstrates how to use Terser for JavaScript minification. It provides examples of both simple code minification and file-based minification, showcasing how to minify JavaScript code using Terser.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published