Hugo: Hugo CSS minify breaks AMP validation

Created on 2 Jan 2020  路  4Comments  路  Source: gohugoio/hugo

Description

Hugo is stripping the space after a parenthesis when doing minification. This happens when doing both resource minification, or when using the --minify option.

Un-minified:

body {
    -webkit-animation: -amp-start 8s steps(1,end) 0s 1 normal both;
    -moz-animation: -amp-start 8s steps(1,end) 0s 1 normal both;
    -ms-animation: -amp-start 8s steps(1,end) 0s 1 normal both;
    animation: -amp-start 8s steps(1,end) 0s 1 normal both
}

Minified:

body{-webkit-animation:-amp-start 8s steps(1,end)0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end)0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end)0s 1 normal both;animation:-amp-start 8s steps(1,end)0s 1 normal both}

The issue is here steps(1,end)0s.

Oddly, when testing with the minify module Hugo is using here it works correctly:

body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}

What version of Hugo are you using?

Hugo Static Site Generator v0.62.0/extended linux/amd64 BuildDate: unknown

Does the issue happen in the latest release?

Yes

Bug Upstream

Most helpful comment

This is fixed in v2.6.2 of minify. Hugo should probably update its version of minify to fix this problem.

All 4 comments

Duplicate of #6563

Same issue with newly added built in minify options. Hugo version 0.68.3

The mandatory text inside tag 'head > style[amp-boilerplate]' is missing or incorrect.

I created an issue on tdewolff #300, because it is an intendant behavior of that lib.

This is fixed in v2.6.2 of minify. Hugo should probably update its version of minify to fix this problem.

Was this page helpful?
0 / 5 - 0 ratings