Hi,
Thanks for maintaining hugo. I love it.
Trying to get a flow as suggested by @bep here.
It worked for half an hour and now I cannot reach the Stratch anymore. In my shortcode I add:
{{ $.Page.Scratch.Add "styles" (slice "scss/shortcodes/timeline.scss") }}
In my partial head.html
I try to read it like:
{{ if .Page.Scratch.Get "styles" }}
<div>working ππΏ</div>
{{ else }}
<div>not working π’</div>
{{end}}
{{ if .Scratch.Get "styles" }}
<div>working ππΏ</div>
{{ else }}
<div>not working π’</div>
{{end}}
{{ $content := .Content }} {{/* Need to invoke .Content to render the shortcodes. */}}
{{- if .HasShortcode "timeline" -}}
<div>working ππΏ</div>
{{ else }}
<div>not working π’</div>
{{end}}
{{ with .Scratch.Get "styles" }}
<div>working ππΏ</div>
{{ range (. | uniq) }}
{{ $scssPath := .}}
{{ $targetCssName := printf "%s.css" . }}
{{ $options := (dict "targetPath" $targetCssName "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $style := resources.Get $scssPath | resources.ToCSS $options | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}" >
{{ end }}
{{ end }}
And I keep getting βnot working β. As mentioned, it was working for a while. Behavior seems to be inconsistent.
How can I get this working? Or is there any better way I can inject a scss thatβs required by a shortcode?