diff options
author | serg <contact@sergfurtak.com> | 2020-07-21 21:17:11 +0300 |
---|---|---|
committer | Sergey Furtak <contact@sergfurtak.com> | 2020-11-17 00:37:45 +0300 |
commit | c5ffd48c4e17c16931169bf599eb1fb207f97e73 (patch) | |
tree | c6643ded2a659771e02f1e974e7e22556666843f | |
parent | fd32eb0dfae3dfac628a50ef89d29305eae2e629 (diff) |
enable source map for sass in development mode
-rw-r--r-- | layouts/404.html | 2 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 2 | ||||
-rw-r--r-- | layouts/partials/head-includes.html | 9 |
3 files changed, 8 insertions, 5 deletions
diff --git a/layouts/404.html b/layouts/404.html index c1c8e08..c9c8caf 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,6 +1,6 @@ {{- define "page-class" -}}error404{{- end -}} {{- define "head-includes" -}} - {{- partial "head-includes.html" . -}} + {{- partialCached "head-includes.html" . -}} <style> .error404 { height: 100%; } diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index f01d93a..d5982e9 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -13,7 +13,7 @@ {{- end -}} <link rel="shortcut icon" href="{{`favicon.ico` | relURL}}"> {{- block "head-includes" . -}} - {{- partial "head-includes.html" . -}} + {{- partialCached "head-includes.html" . -}} {{- end -}} </head> <body> diff --git a/layouts/partials/head-includes.html b/layouts/partials/head-includes.html index 6afa957..9058b6e 100644 --- a/layouts/partials/head-includes.html +++ b/layouts/partials/head-includes.html @@ -323,10 +323,13 @@ } </style> <noscript id="deferredCss"> - {{$sassOptions := (dict "targetPath" "css/app.css")}} + {{$isProduction := hugo.IsProduction | or (eq .Site.Params.env "production")}} + {{$sassOptions := dict "targetPath" "css/app.css" "enableSourceMap" (not $isProduction)}} + {{$css := resources.Get "scss/app.scss" | toCSS $sassOptions}} - {{if eq (hugo.Environment) "production" | or (eq .Site.Params.env "production")}} - {{$css = $css | minify | fingerprint}} + + {{if $isProduction}} + {{$css = $css | minify | fingerprint}} {{end}} <link rel="stylesheet" href="{{$css.RelPermalink}}"> </noscript> |