Skip to content

Commit

Permalink
Don't change options, fixes #720
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Jul 2, 2024
1 parent 675afc8 commit 3658dff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions css/css.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ func (t Token) IsLengthPercentage() bool {

// Minify minifies CSS data, it reads from r and writes to w.
func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, params map[string]string) error {
tmp := &Minifier{}
*tmp = *o
o = tmp

o.newPrecision = o.Precision
if o.newPrecision <= 0 || 15 < o.newPrecision {
o.newPrecision = 15 // minimum number of digits a double can represent exactly
Expand Down
1 change: 1 addition & 0 deletions html/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st
if o.KeepConditionalComments {
fmt.Println("DEPRECATED: KeepConditionalComments is replaced by KeepSpecialComments")
o.KeepSpecialComments = true
o.KeepConditionalComments = false // omit next warning
}

omitSpace := true // if true the next leading space is omitted
Expand Down
4 changes: 4 additions & 0 deletions svg/svg.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func Minify(m *minify.M, w io.Writer, r io.Reader, params map[string]string) err

// Minify minifies SVG data, it reads from r and writes to w.
func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, params map[string]string) error {
tmp := &Minifier{}
*tmp = *o
o = tmp

o.newPrecision = o.Precision
if o.newPrecision <= 0 || 15 < o.newPrecision {
o.newPrecision = 15 // minimum number of digits a double can represent exactly
Expand Down

0 comments on commit 3658dff

Please sign in to comment.