PHPackages                             ibertrand/magento2-terser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ibertrand/magento2-terser

ActiveBinary[Utility &amp; Helpers](/categories/utility)

ibertrand/magento2-terser
=========================

A Bash script that minifies JavaScript files in a Magento installation

v0.0.8(2y ago)34.2kMITShell

Since Apr 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ImanuelBertrand/magento-terser)[ Packagist](https://packagist.org/packages/ibertrand/magento2-terser)[ RSS](/packages/ibertrand-magento2-terser/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)DependenciesVersions (9)Used By (0)

Magento 2 Terser
================

[](#magento-2-terser)

A Bash script that uses `terser` to minify your JavaScript files and can be run in the root directory of your Magento 2 installation.

The script will minify all JavaScript files in the pub/static/frontend directory of your Magento 2 installation, except for those that are already minified or the requirejs-bundle-config.js file. The minification tasks can be run in parallel for increased performance.

Installation
------------

[](#installation)

You can install the package using Composer. Run the following command in your terminal:

```
composer require ibertrand/magento2-terser
```

Alternatively, you can download the file `minify-m2-scripts.sh` directly and save it wherever you want.

The script requires the `terser` command to be available. If you don't have it installed, you can install it globally with `npm`:

```
npm install terser -g
```

If you don't have `npm` installed, you need to install it first.

Usage
-----

[](#usage)

To run the script, open a terminal in the root directory of your Magento 2 installation and run:

```
vendor/bin/minify-m2-scripts.sh
```

This is assuming you installed the package using Composer. If you downloaded the file directly, you need to run the script with the full path to the file.

By default, the script will minify all JavaScript files in the `pub/static/frontend` directory of your Magento 2 installation, except for those that are already minified or the `requirejs-bundle-config.js` file.

The original files will be replaced with the minified versions. If your M2 instance is in developer mode, this might alter files outside of the `pub/static/frontend` directory because of symlinks.

You can run the script with the `-v` or `--verbose` flag to display the name of each file that is being minified. Alternatively, you can run it with `--no-progress-bar` or with `--silent`, which includes `--no-progress-bar`.

### Parallel execution

[](#parallel-execution)

The script supports parallel execution of minification tasks to speed up the process. To specify the number of jobs to run in parallel, you can use the -j option followed by the number of jobs or --jobs= followed by the number of jobs.

For example, to run 3 jobs in parallel, you could use either of the below commands:

```
vendor/bin/minify-m2-scripts.sh -j3
vendor/bin/minify-m2-scripts.sh -jobs=3

```

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~17 days

Recently: every ~0 days

Total

8

Last Release

1012d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6ec06512b21bf45e3bf889291c8a03ca7b19c20e22acc3d5f3d4a6c35c9092d?d=identicon)[Imanuel](/maintainers/Imanuel)

---

Top Contributors

[![ImanuelBertrand](https://avatars.githubusercontent.com/u/15913558?v=4)](https://github.com/ImanuelBertrand "ImanuelBertrand (11 commits)")

### Embed Badge

![Health badge](/badges/ibertrand-magento2-terser/health.svg)

```
[![Health](https://phpackages.com/badges/ibertrand-magento2-terser/health.svg)](https://phpackages.com/packages/ibertrand-magento2-terser)
```

###  Alternatives

[nebkam/symfony-traits

Helper trait to ease writing APIs in Symfony

156.7k](/packages/nebkam-symfony-traits)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
