package
1.1.0
Repository: https://github.com/joshuarli/minify.git
Documentation: pkg.go.dev

# README

Minify

Minify is a CLI implemention of the minify library package.

Installation

Make sure you have Go and Git installed.

Run the following command

go get github.com/tdewolff/minify/cmd/minify

and the minify command should be in your $GOPATH/bin.

Usage

Usage: minify [options] [file]
Options:
  -o: Output file (stdout when empty)
  -x: File extension (css, html, js, json, svg or xml), optional for input files
  -d: Directory to search for files
  -r: Recursively minify everything

Examples

The following commands are variations one can use to minify a file:

$ minify -o file.min.html file.html

$ minify -x css -o file.min.less file.less

$ minify -x js < file.js > file.min.js

$ cat file.html | minify -x html > file.min.html

It is also possible to overwrite the input file by the output file. However, this won't work with input/output redirection streams. Using the following command the input file will be loaded into memory first before writing to the output file:

$ minify -o file.html file.html

The following commands minify the files in a directory:

$ minify -d path/to/dir

$ minify -d path/to/dir -r