https://github.com/jadiagaurang/minify-all-cli
Minify All JS, CSS and HTML files in a folder by using UglifyJS/terser, CSSNano and HTMLMinifier with an option to gzip all the files as well.
https://github.com/jadiagaurang/minify-all-cli
cli command-line command-line-tool compression cssnano google htmlminify lighthouse minify pagespeed terser uglifyjs uglifyjs-folder
Last synced: 5 months ago
JSON representation
Minify All JS, CSS and HTML files in a folder by using UglifyJS/terser, CSSNano and HTMLMinifier with an option to gzip all the files as well.
- Host: GitHub
- URL: https://github.com/jadiagaurang/minify-all-cli
- Owner: jadiagaurang
- License: mit
- Created: 2022-03-14T17:35:54.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-11T01:53:55.000Z (about 4 years ago)
- Last Synced: 2025-12-24T21:25:48.803Z (5 months ago)
- Topics: cli, command-line, command-line-tool, compression, cssnano, google, htmlminify, lighthouse, minify, pagespeed, terser, uglifyjs, uglifyjs-folder
- Language: HTML
- Homepage:
- Size: 14.3 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Minify All CLI
[](https://github.com/jadiagaurang/minify-all-cli/actions/workflows/node.js.yml)
[](https://github.com/jadiagaurang/minify-all-cli/actions/workflows/npm-publish.yml)
[](https://www.npmjs.com/package/minify-all-cli)
Minify All JS, CSS and HTML files in a folder by using [UglifyJS](https://github.com/mishoo/UglifyJS), [CSSNano](https://github.com/cssnano/cssnano) and [HTMLMinifier](https://github.com/kangax/html-minifier) with an option to gzip all the files as well.
Package also supports processCount to set maximum degree of parallelism.
## Motivation
Google PageSpeed Insights suggests to [Minify Resources (HTML, CSS, and JavaScript)](https://developers.google.com/speed/docs/insights/MinifyResources) to boost web page's loading speed.
## Installation
```bash
npm install -g minify-all-cli
```
## Command Line Usage
```bash
minify-all-cli -s [source folder] -d [destination folder] [options]
```
### Command Line Options
```bash
Usage: -s -d
Options:
--help Show help [boolean]
--version Show version number [boolean]
-j, --skipJS Should minify JavaScript the file or skip it? [boolean]
-c, --skipCSS Should minify CSS the file or skip it? [boolean]
-h, --skipHTML Should minify HTML the file or skip it? [boolean]
-g, --doGzip Should gzip the file or skip it? [boolean]
-x, --jsCompressor Which JavaScript mangler/compressor to use for
minification? Default: uglifyjs [string]
-m, --skipFileMasks Partial Filder Path to skip minification [array]
-e, --skipFileExtensions File Extensions to skip it over [array]
-i, --ignoreFileMasks Partial Filder Path to ignore minification and
copy to destination [array]
-f, --configFile Specifies a json configuration file for the
UglifyJS/terser, CSSNano and HTML Minifier
module [string]
-l, --logLevel Set log level to print warn, log, error, fatal
messages [string]
-p, --processCount Specifies process count to set maximum degree
of parallelism [number]
```
## CLI Example
```bash
npx minify-all-cli \
-s "/home/ubuntu/source" -d "/home/ubuntu/compressed" \
--skipFileExtensions=.mp3 --skipFileExtensions=.mp4 \
--logLevel=warn
```
All other examples are available [here](https://github.com/jadiagaurang/minify-all-cli/tree/main/tests).
## License
Please see the [license file](https://github.com/jadiagaurang/minify-all-cli/blob/main/LICENSE) for more information.