diff --git a/html/html.go b/html/html.go index 23cd2ca07..6200bcdc8 100644 --- a/html/html.go +++ b/html/html.go @@ -309,7 +309,7 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st // skip text in select and optgroup tags if t.Hash == Option || t.Hash == Optgroup { - if next := tb.Peek(0); next.TokenType == html.TextToken { + if next := tb.Peek(0); next.TokenType == html.TextToken && !next.HasTemplate { tb.Shift() } } diff --git a/html/html_test.go b/html/html_test.go index bce072743..bee45114a 100644 --- a/html/html_test.go +++ b/html/html_test.go @@ -378,6 +378,7 @@ func TestHTMLTemplates(t *testing.T) { {`