From a7a017b68a0719b2d21f6315729dc6f2e377b620 Mon Sep 17 00:00:00 2001 From: iGor milhit Date: Sun, 15 Dec 2019 15:45:47 +0100 Subject: [PATCH] style: start using SASS and assets * NEW Adds assets/scss directories. * Copies static/styles.css to assets/scss/main.scss * Improves head layouts to compile assets depending if on server or build. Co-Authored-by: Igor Milhit --- static/style.css => assets/scss/main.scss | 0 layouts/partials/head.html | 11 ++++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) rename static/style.css => assets/scss/main.scss (100%) diff --git a/static/style.css b/assets/scss/main.scss similarity index 100% rename from static/style.css rename to assets/scss/main.scss diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 5eff54a..abe664f 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -3,7 +3,16 @@ {{ .Title }} | {{ .Site.Title }} - + {{ if .Site.IsServer }} + {{ $options := (dict "targetPath" "styles.css" "enableSourceMap" true) }} + {{ $styles := resources.Get "scss/main.scss" | toCSS $options }} + + {{ else }} + {{ $options := (dict "targetPath" "styles.css") }} + {{ $styles := resources.Get "scss/main.scss" | toCSS $options | minify }} + + {{ end }} + {{ with .OutputFormats.Get "RSS" }} {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end }}