Skip to content

Instantly share code, notes, and snippets.

@inwardmovement
Created January 27, 2020 09:12
Show Gist options
  • Save inwardmovement/186cd4eb5cc468fde4a2347fbb003349 to your computer and use it in GitHub Desktop.
Save inwardmovement/186cd4eb5cc468fde4a2347fbb003349 to your computer and use it in GitHub Desktop.
Inline styles with Hugo
{{ with .Site.IsServer }}
<!-- Do not inline styles -->
<link rel="stylesheet" href="{{ $mainCSS.RelPermalink }}">
{{ end }}
<style>
{{ with or (getenv "PREVIEW") (getenv "PRODUCTION") }}
<!-- Inline styles -->
{{ $mainCSS.Content | safeCSS }}
{{ end }}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment