Hugo: Minification example not working

Created on 20 Dec 2019  路  1Comment  路  Source: gohugoio/hugo

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.61.0/extended darwin/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

Yes

Following the example here, I have the following template in layouts/_default/baseof.html:

{{ if .Params.katex }}
{{ resources.Get "css/katex.css" | minify | fingerprint | .Page.Scratch.SetInMap "css" "katex" }}
{{ end }}

which results in the following build error:

ERROR 2019/12/19 22:38:57 Failed to render pages: render of "page" failed: executing "_default/single.html" at <minify>: wrong type for value; expected resources.ResourceTransformer; got resource.Resource

Searching for ResourceTransformer comes up with nothing on the Hugo website or on Google.

Most helpful comment

So the problem was that I was keeping my CSS and JS files under the static directory (as directed here) while the resources.Get functions look under assets (as noted here).

I'll close the issue since this is just a case of user error; however, this seems like a gotcha for newbies (like me) and it might be worth updating the documentation (maybe adding a footnote to the static section saying that there is a difference between static and assets?)

>All comments

So the problem was that I was keeping my CSS and JS files under the static directory (as directed here) while the resources.Get functions look under assets (as noted here).

I'll close the issue since this is just a case of user error; however, this seems like a gotcha for newbies (like me) and it might be worth updating the documentation (maybe adding a footnote to the static section saying that there is a difference between static and assets?)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

digitalcraftsman picture digitalcraftsman  路  3Comments

arikroc picture arikroc  路  3Comments

sigma picture sigma  路  3Comments

chrissparksnj picture chrissparksnj  路  3Comments

MunifTanjim picture MunifTanjim  路  3Comments