Hugo 0.47 --minify fails with "parse error:3:5: unexpected ending in qualified rule, expected left brace token 3:<"

#1

Hi all, I just tried to build the site with 0.47’s new hugo --minify.

Unfortunately it failed both locally and on Netlify, mentioning a parse error:3:5: unexpected ending in qualified rule, expected left brace token 3: < that I’ve never seen or heard of before.

Google isn’t helpful on that one either.

Please note that using the regular build command hugo the site builds just fine.

Here’s the output of hugo env:

Hugo Static Site Generator v0.47 windows/amd64 BuildDate: 2018-08-17T09:15:51Z
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.10.3"

Here’s the verbose log of the error:

C:\Hugo\Sites\process4.biz>hugo --minify -v
INFO 2018/08/17 13:33:33 Using config file: C:\Hugo\Sites\process4.biz\config.toml
Building sites … INFO 2018/08/17 13:33:33 syncing static files to C:\Hugo\Sites\process4.biz\public\
INFO 2018/08/17 13:33:33 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO 2018/08/17 13:33:33 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO 2018/08/17 13:33:33 Alias "de" translated to "de\index.html"
INFO 2018/08/17 13:33:33 Alias "\post\page\1\index.html" translated to "post\page\1\index.html"
INFO 2018/08/17 13:33:33 Alias "\categories\page\1\index.html" translated to "categories\page\1\index.html"
INFO 2018/08/17 13:33:33 Alias "\tags\content\page\1\index.html" translated to "tags\content\page\1\index.html"
INFO 2018/08/17 13:33:33 Alias "\categories\development\page\1\index.html" translated to "categories\development\page\1\index.html"
INFO 2018/08/17 13:33:33 Alias "\tags\dsgvo\page\1\index.html" translated to "tags\dsgvo\page\1\index.html"
INFO 2018/08/17 13:33:34 Alias "\tags\p4b\page\1\index.html" translated to "tags\p4b\page\1\index.html"
INFO 2018/08/17 13:33:34 Alias "\tags\page\1\index.html" translated to "tags\page\1\index.html"
INFO 2018/08/17 13:33:34 Alias "\categories\use-case\page\1\index.html" translated to "categories\use-case\page\1\index.html"
INFO 2018/08/17 13:33:34 Alias "\tags\website\page\1\index.html" translated to "tags\website\page\1\index.html"
INFO 2018/08/17 13:33:34 Alias "\categories\website\page\1\index.html" translated to "categories\website\page\1\index.html"
Total in 1086 ms
Error: Error building site: Error(s) rendering pages: parse error:3:5: unexpected ending in qualified rule, expected left brace token
    3:     <
           ^

I would be thankful for any pointers as to where to look for the cause of the issue.

#2

You’ll have more eyes helping if you share your project’s code, and follow the advice at Requesting Help. :slight_smile:

#3

You’re right, hard to tell without the actual site.

I just set up a debug repo at https://github.com/ttntm/p4b-debug.git to have a look at.

The content’s the same as the live site and the error can be reproduced with this repo by simply running hugo --minify to build the site.

#4

I finally found the culprit: there was some minified CSS inside a <style> tag in our head.html partial and somehow this line had an extra closing bracket that ended up causing this error.

Difficult to find but now hugo --minify runs without that error.

1 Like
#5

Just want to add to that this can happen with linked styles too, for me it was a merge conflict leftover in the minified files who cause the error, really hard to find.