Releases: tdewolff/minify
Releases · tdewolff/minify
v2.9.6
v2.9.5
- cmd: minify input even if extension is unknown but type/mimetype is given
- CSS: fix timeout in property with many commas
- CSS: convert RGBA to
transparent
only if the color is fully transparent black (and not any other transparent color), fixes #332 - CSS: fix crash when rgb/rgba functions have less than three arguments
- CSS: fix
box-shadow
valuenone
conversion to0 0
as they are not equivalent, fixes #332 - HTML: remove space between attributes when after a quoted value
- HTML: keep empty
title
andlang
attributes, fixes #331 - JS: merge variable declarations even if one has an ObjectPattern
- JS: remove trailing commas in BindingArray (except when Rest ellipsis is set)
- JS: add parenthesis around object literal in arrow function body, fixes #333
v2.9.4
v2.9.3
- CSS: minify comma-separated lists for
box-shadow
,background
,background-repeat
,background-size
, andbackground-position
properties (fixes #322) - CSS/SVG: remove deprecated
Decimals
options in favor ofPrecision
- cmd: remove
--decimals
options for CSS and SVG minifiers in favor of--precision
- cmd: add
--bundle
option to explicitly bundle (concatenate/merge) files into one, do not asume from the-o
options if it lacks a/
at the end that it outputs to a file and thus needs to merge the inputs - cmd: directory inputs needs
--recursive
, previously directories would be expanded by defaults (but not their subdirectories). This matches behaviour of thecp
command and will be more intuitive. - cmd: file inputs are copied without considering and recreating its directory path. For example,
minify -o out path/to/file
would output toout/path/to/file
but will now output toout/file
. This is the same behaviour as thecp
command and will be more intuitive for users.
v2.9.2
v2.9.1
- JS: fix parsing
in
identifier in group expressions - JS: fix parsing identifiers inside arrow function body in some cases #324
- JS: keep all license comments at the top of the file
- JS: minify
typeof x==='undefined'
totypeof x=='undefined'
- JS: merge expressions and var declarations with
for
with empty initializer or withwhile
statement converted tofor
- JS: iteratively merge
if(a){return b}if(c){return d}return e
chains toreturn a?b:c?d:e
v2.9.0
- Add JS (ECMAScript 2020) minifier
- Improve benchmark functions
- Predefine byte-slices instead of inline for performance
- Don't check write errors to output during minification, but check at the end only
- Lexers/parser now require passing
parse.Input
instead ofio.Reader
- Rename subpackage
min
tominify
JS minifier overview
Features:
- remove superfluous whitespace
- remove superfluous semicolons
- shorten
true
,false
, andundefined
to!0
,!1
andvoid 0
- rename variables and functions to shorter names (not in global scope)
- move
var
declarations to the top of the global/function scope (if more than one) - collapse
if
/else
statements to expressions - minify conditional expressions to simpler ones
- merge sequential expression statements to one, including into
return
andthrow
- remove superfluous grouping in expressions
- shorten or remove string escapes
- convert object key or index expression from string to identifier or decimal
- merge concatenated strings
- rewrite numbers (binary, octal, decimal, hexadecimal) to shorter representations
It compresses files at about 25 MB/s (only minifying, not considering reading/writing files) which is (much) faster than existing minifiers. Compression rate is between 1.5 and 3.0 depending on the file (respectively, the compression file size is between 35% -- 65% of the original). Example of known files:
File | Original Size | Compressed Size | Ratio | Time | Speed |
---|---|---|---|---|---|
ace.js | 644 kB | 346 kB | 53.7% | 34ms | 19 MB/s |
dot.js | 5.2 kB | 3.3 kB | 64.9% | 563µs | 9.2 MB/s |
jquery.js | 247 kB | 85 kB | 34.4% | 11ms | 22 MB/s |
jqueryui.js | 470 kB | 241 kB | 51.3% | 26ms | 18 MB/s |
moment.js | 99 kB | 35 kB | 34.9% | 4ms | 24 MB/s |
The minifier has been tested for a number of web applications including WordPress. The go-fuzz
fuzzer has been used extensively in order to detect bugs, and will continue finding bugs using https://github.com/google/oss-fuzz
v2.8.0
WARNING for package maintainers, some files have been renamed, adjust your build scripts accordingly.
- Use Makefile instead of GoReleaser to build releases for all architectures, use
make release
. This fixes theREADME.md
file location inside the archives to be in the root of the archive - Release archives will no longer have the version name explicitly stated, fixes #316
- Remove
cmd/minify/install.sh
, usemake install
instead - Rename
cmd/minify/minify_bash_tab_completion
tocmd/minify/bash_completion
- Rename
LICENSE.md
toLICENSE
as it is not a Markdown file - Rename
min
subpackage tominify
- cmd: running
minify
without arguments will print a more informative error message - cmd: bad arguments will not display cmd usage automatically
v2.7.7
- cmd: fix file paths on Windows when input and output directories are equal (slash vs backslash)
- cmd: add
--cpuprofile
and--memprofile
options - cmd: fix usage of
--match
and--sync
simultaneously, fixes #315 - cmd:
--match
applies to all filename inputs not just under directories - CSS: remove whitespace around custom variable value, fixes #305
- JSON: minify numbers, fixes #302
- HTML: fix slow parsing of
<a>
tag with manyname
orid
attributes (OSS-Fuzz) - Don't replace space by
+
in DataURI, fixes #314 - Don't escape
@ : ; = ? + , / $ \t \n \r
in DataURIs (works for Chrome, Firefox, Opera, Edge, Safari, Yandex, and IE9, IE10, IE11)
v2.7.6
- HTML: remove text and whitespace within
select
andoptgroup
tags - CSS: fix slow parsing of selectors when they contain many errors (OSS-Fuzz)
- CSS: fix RGB/HSL when a parameter overflows (OSS-Fuzz)
- CSS: fix slow parsing of large HSL parameters (OSS-Fuzz)
- cmd: properly run defer calls after command ends, may fix some race bugs
- Add easy API in the
min/
subpackage - Add project to OSS-Fuzz