diff options
author | Hanzei <hanzei@mailbox.org> | 2018-07-20 19:27:34 +0300 |
---|---|---|
committer | Hanzei <hanzei@mailbox.org> | 2018-07-20 19:27:34 +0300 |
commit | 452913c1faedcc20cf500555fa33443464ed7741 (patch) | |
tree | 8675390d98a3a59047e6d6ac248d85b4df91c514 /layouts | |
parent | 80c0c42f93fe73ba3e451098e46f22367e919496 (diff) |
Place custom css under assets
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/head/css.html | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html index 53753a7..0079b5f 100644 --- a/layouts/partials/head/css.html +++ b/layouts/partials/head/css.html @@ -1,16 +1,18 @@ -{{ $file := "sass/style.sass" }} +{{ $bundleRaw := resources.Get "sass/style.sass" | resources.ExecuteAsTemplate "style/main.tmp.css" . }} + {{ 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"> +{{ $bundle := $bundleRaw | toCSS $cssOpts }} +<link rel="stylesheet" href="{{ $bundle.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"> +{{ $bundle := $bundleRaw | toCSS $cssOpts | postCSS $postCSSOpts | minify | fingerprint }} +<link rel="stylesheet" href="{{ $bundle.Permalink }}" integrity="{{ $bundle.Data.Integrity }}" media="screen"> {{ end }} <!-- Custom css --> {{ range .Site.Params.customCSS -}} - <link rel="stylesheet" href="{{ . | absURL }}"> + {{ $style := resources.Get . }} + <link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}" media="screen"> {{- end }} |