Releases: tdewolff/minify
Releases · tdewolff/minify
v2.5.0
- CSS: fix position information in error context
- CSS: fix
background-position
panic with offsets that are zero - HTML: trim and collapse whitespace in certain attribute values
- SVG: shorten cubic and quadratic Beziér path data to their shorter format or to line segments
v2.4.0
- When minifying floating points, remove trailing zeros and not other numbers
- Make
M
concurrent-safe - HTML: keep double quotes around XML-flavour RDFa attributes
- CSS: revert the use of the
#RRGGBBAA
format as proposed in Color Module Level 4 as it is not yet an official W3C recommendation - CSS:
background-position
(also withinbackground
) now works with 3 and 4 values as well - SVG: skipping
metadata
orrect
tags properly even if they are closed by a void tag (like<rect/>
) - SVG pathdata: when cursor doesn't move, don't emit any commands
Go modules support #2
I'm suspecting that go mod
gets confused from a previously reverted v2.3.7
release, so just in case this is a new release that will hopefully fix:
$ go get -u github.com/tdewolff/minify/v2
go: github.com/tdewolff/minify/[email protected]: go.mod has non-.../v2 module path "github.com/tdewolff/minify" (and .../v2/go.mod does not exist) at revision v2.3.7
go get: error loading module requirements
Go modules support
Add Go modules support by using the github.com/tdewolff/minify/v2
import path.
WARNING: this release may give errors for go mod
probably due to (local) caching...
Bugfixes and improved CSS minifier
Important: default mimetype for JavaScript is now application/javascript
(it used to be text/javascript
).
- HTML bugfix: keep empty
value
attribute on<input type="radio">
, because the default is not an empty string - HTML bugfix: prevent IE conditional comments from panicking in some instances
- CSS: handle
local()
for URLs - CSS: support
rgb()
andhsl()
with spaces instead of commas - CSS: improve minification for
font
,background
,background-position
,background-repeat
,background-size
,outline
andborder
declarations - CSS: reintroduce support for IE star-declaration hack
- CSS bugfix:
margin
andpadding
now check if values that are functions (such ascalc()
) are equal and thus eligible for collapsing - CSS bugfix: parse bad declarations better
- CSS bugfix: add space for attribute selector case insensitivity between the value and
i
as ininput[type="radio" i]
- CSS bugfix: do not collapse
outline
to0
but tonone
- CSS bugfix: opacity for
rgba()
andhsla()
in CSS2 cannot be rewritten as#rrggbbaa
- SVG bugfix: only use the first pair of coordinates for
M
to move back to when encounteringZ
Bugfixes and bash completion
- CLI: Add bash completion for the
minify
command - CLI: improved error messages
- CLI bugfix: don't open all files at once when concatenating, which usually panics when >10000 files are open
- CLI bugfix: don't minify modified files twice when watching them
- Bugfix: prevent panic on long decimals with negative exponent, where rewriting would previously cause longer numbers
- HTML: accept alternative syntax for MS conditional comments
- HTML bugfix:
draggable
is not a boolean - HTML bugfix: do not assume mediatype in
<meta content="x">
- CSS: add option for CSS2 numbers without exponents
- CSS: trim space in
url()
- CSS: minify
box-shadow
,background
and@import
better - CSS bugfix: prevent panic for functions with no arguments or end parenthesis
- CSS bugfix: keep dimensions for zeros in
flex
property - CSS bugfix: keep other values for
outline
andborder
when width is zero - CSS bugfix: font
normal
now handled - CSS bugfix: add quotes to unquotes
url()
when we can remove theurl
function - CSS bugfix: only omit number dimensions for and
- JS bugfix: ASI behaviour for template literals
- JS bugfix: replace comment as space when comment is removed
- JS bugfix: divide by regular expression
- SVG: don't remove empty groups anymore, as CSS or JS might rely on them
- SVG bugfix: prevent panic on invalid pathdata for arcs
Bugfixes found by fuzz testing
This release fixes a number of out-of-bounds panics that could arise in HTML, XML and JS sources. It also allows HTML sources to contain the NULL byte.
Remove dependencies on buffer and strconv
v2.3.3 Change buffer to parse/buffer
v2.3.1
Performance
- Large performance increase by using a buffer that holds all contents, instead of a streaming buffer: 9904fe7
- Add standardized samples for benchmark tests
- Parsing errors now show line number, column and context (the content of the offending line)
- HTML: optimize
a
minification