magento / magento/baler

Minify unbundled files with Terser

Open
#4 15 comments 2 reactions 1 assignee View on GitHub

@DrewML is already working on this.

Since Aug 20, 2019.

enhancement
Dominant language
JavaScript
Stars
176
Forks
28
PR merge metrics
No merged PRs in 30d

Description

- [`terser`](https://github.com/terser-js/terser)

## Requirements
1. For each theme that is processed, all deployed `.js` files that are _not_ in `core-bundle.js` should be minified through terser
2. Minified files should be written in-place (same file name) to avoid the need for any path rewriting at build or runtime.
3. Minification should happen in worker threads, to speed up compilation time and avoid blocking the main thread's bundling work

## Pieces

- For worker-based minification, there's already the [`createMinifier`](https://github.com/magento/baler/blob/580079893561a89408e2602b48f484e062db3f80/src/createMinifier.ts) module that will create a pool of minification workers. We'll want to add a `minifyFromFile` API, though, so we don't need to read loose files into memory in the main process and then serialize/transfer/parse in the worker

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.