hugo-theme-introduction/layouts/partials/head/css.html
2018-07-12 12:15:25 +02:00

16 lines
830 B
HTML

{{ $file := "sass/style.sass" }}
{{ if .Site.IsServer }}
{{ $cssOpts := (dict "targetPath" "styles/main.css" "enableSourceMap" true ) }}
{{ $styles := resources.Get $file | resources.ExecuteAsTemplate "style/main.tmp.css" . | toCSS $cssOpts }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">
{{ else }}
{{ $cssOpts := (dict "targetPath" "styles/main.css" ) }}
{{ $postCSSOpts := (dict "use" "autoprefixer" ) }}
{{ $styles := resources.Get $file | resources.ExecuteAsTemplate "style/main.tmp.css" . | toCSS $cssOpts | postCSS $postCSSOpts | minify | fingerprint }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">
{{ end }}
<!-- Custom css -->
{{ range .Site.Params.customCSS -}}
<link rel="stylesheet" href="{{ . | relURL }}">
{{- end }}