Understanding targetPath with SCSS and Hugo Pipes

I have canonifyurls: true in my site config, but it doesn’t seem to be affecting the output of {{ $style.Permalink }}.

{{ $options := (dict "targetPath" "/css/main.css" "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $style := resources.Get "sass/styles.scss" | toCSS $options | postCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}">

My two environments have different BaseURLs:

  • Production: https://www.fws.gov/southeast/
  • Staging: https://intranet.fws.gov/region4/demo/

The output URLs are as follows:

<link rel="stylesheet" href="https://intranet.fws.gov/region4/css/main.min.80b1bb2f29d8811c1f83e5164d0bd2314717d173a14186aa208c5abe546461ca.css">

<link rel="stylesheet" href="https://www.fws.gov/css/main.min.80b1bb2f29d8811c1f83e5164d0bd2314717d173a14186aa208c5abe546461ca.css">

Am I doing something wrong with my targetPath? I tried dropping the leading / without any luck.

This looks like a bug. Regardless of the value of canonifyurls, the .Permalink should have provided a URL with the full BaseURL (including subdirs) as a prefix.