Just add the following alias to your .bashrc (or .bash_profile in OSX):
alias uglify='docker run --rm -v `pwd`:/workdir -w /workdir semenovp/tiny-uglify:latest'
Its usage: uglify <command> [input files] [options]
.
These are two obvious commands:
Command | Description |
---|---|
js | Call uglifyjs (see its usage) |
css | Call uglifycss (see its usage) |
Now your shell is ready to go. For example, do like this:
uglify js --compress --mangle --toplevel --output output.js input.js
uglify css --expand-vars --max-line-len 500 --output output.css input.css
docker build --build-arg vcsref="$(git rev-parse --short HEAD)" -t semenovp/tiny-uglify:latest .
Review the sizes of another uglify
images retrieved from DockerHub against current one built on Node.js v15.3.0.
Note, the original node:alpine is of 37.85Mb / 109Mb.
REPOSITORY | YYYY-MM-DD | COMPRESSED / UNCOMPRESSED SIZE |
---|---|---|
semenovp/tiny-uglify:latest | 2020-12-09 | 30.35MB / 81.9MB |
sirehna/uglify:RELEASE-2020-05-05 | 2020-05-05 | 58.24MB / 169MB |
olbat/uglify:latest | 2020-11-29 | 142.89MB / 389MB |
minty/uglifyjs:2.0 | 2015-07-24 | 242.10MB / 642MB |
davidlartey/uglifyjs:0.1.1 | 2016-02-26 | 243.72M / 645MB |
dmilhdef/uglify-js-smith:latest | 2016-09-11 | 245.16M / 656MB |