Skip to content

Instantly share code, notes, and snippets.

@jmooring
Last active September 2, 2023 02:51
Show Gist options
  • Save jmooring/9f9ca79810177b0ab03d03e4d8ad2382 to your computer and use it in GitHub Desktop.
Save jmooring/9f9ca79810177b0ab03d03e4d8ad2382 to your computer and use it in GitHub Desktop.
Hugo - Transpile Sass to CSS
{{ with resources.Get "sass/main.scss" }}
{{ $opts := dict "targetPath" "css/main.css" }}
{{ with . | toCSS $opts }}
{{ if eq hugo.Environment "development" }}
<link rel="stylesheet" href="{{ .RelPermalink }}">
{{ else }}
{{ with . | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }}
{{ end }}
{{ end }}
{{ end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment