The resources.Copy
method retains the min
identifier in the resulting path.
Examples:
{{ (resources.Get "x.css" | minify).RelPermalink }} --> /x.min.css
{{ (resources.Get "x.css" | minify | resources.Copy "y.css").RelPermalink }} --> /y.min.css
{{ ((resources.Get "x.css" | minify).Content | resources.FromString "y.css").RelPermalink }} --> /y.css
The last one does what you want. In full:
{{ $css := (resources.Get "style.css" | minify).Content | resources.FromString "style.css" }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
Credit to @pamubay reference https://discourse.gohugo.io/t/36397/3.