From 452913c1faedcc20cf500555fa33443464ed7741 Mon Sep 17 00:00:00 2001 From: Hanzei Date: Fri, 20 Jul 2018 18:27:34 +0200 Subject: [PATCH] Place custom css under assets --- exampleSite/config.toml | 2 +- layouts/partials/head/css.html | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 17bc030..753d547 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -11,7 +11,7 @@ DefaultContentLanguage = "en" # Default language fo fadeIn = true # Turn on/off the fade-in effect dateFormat = "Jan 2, 2006" email = "youremail@email.com" # E-mail address for contact section - # customCSS = ["foo.css"] # Include custom css files + # customCSS = ["foo.css"] # Include custom css files placed under assets/ # Configure the home page [params.home] 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 }} - +{{ $bundle := $bundleRaw | toCSS $cssOpts }} + {{ 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 }} - +{{ $bundle := $bundleRaw | toCSS $cssOpts | postCSS $postCSSOpts | minify | fingerprint }} + {{ end }} {{ range .Site.Params.customCSS -}} - + {{ $style := resources.Get . }} + {{- end }}