diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 29ad5768d..e39062914 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,5 +1,8 @@ - + {{ partial "head.html" . }} diff --git a/layouts/blog/baseof.html b/layouts/blog/baseof.html index b378805af..97f5951ae 100644 --- a/layouts/blog/baseof.html +++ b/layouts/blog/baseof.html @@ -1,5 +1,8 @@ - + {{ partial "head.html" . }} diff --git a/layouts/blog/baseof.print.html b/layouts/blog/baseof.print.html index 99e3c1c4d..21e63c5f7 100644 --- a/layouts/blog/baseof.print.html +++ b/layouts/blog/baseof.print.html @@ -1,5 +1,8 @@ - + {{ partial "head.html" . }} diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index 210b6af52..2a640c3a3 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -1,5 +1,8 @@ - + {{ partial "head.html" . }} diff --git a/layouts/docs/baseof.print.html b/layouts/docs/baseof.print.html index 41e0659b3..e839aa946 100644 --- a/layouts/docs/baseof.print.html +++ b/layouts/docs/baseof.print.html @@ -1,5 +1,8 @@ - + {{ partial "head.html" . }} diff --git a/layouts/partials/head-css.html b/layouts/partials/head-css.html index d2178317d..484efe79b 100644 --- a/layouts/partials/head-css.html +++ b/layouts/partials/head-css.html @@ -1,11 +1,27 @@ +{{ $scssMain := "scss/main.scss" -}} +{{ $css := resources.Get $scssMain + | toCSS (dict "enableSourceMap" (not hugo.IsProduction)) -}} +{{ $rtlCSS := + cond (eq .Site.Language.LanguageDirection "rtl") + (resources.Get "vendor/bootstrap/dist/css/bootstrap.rtl.css") + nil -}} + +{{ if hugo.IsProduction -}} + {{ with $rtlCSS -}} + {{ $rtlCSS = . | postCSS | minify | fingerprint -}} + {{ end -}} + {{ $css = $css | postCSS | minify | fingerprint -}} + +{{- end -}} + +{{/* NOTE: when not in production, we don't apply `postCSS`. This makes it +snappier to develop in Chrome, but makes it look sub-optimal in other browsers. +*/ -}} -{{ $scssMain := "scss/main.scss"}} -{{ if not hugo.IsProduction }} -{{/* Note the missing postCSS. This makes it snappier to develop in Chrome, but makes it look sub-optimal in other browsers. */}} -{{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" true) }} -{{ else }} -{{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" false) | postCSS | minify | fingerprint }} - - -{{ end }} + +{{ with $rtlCSS -}} + +{{ end -}} + +{{- /**/ -}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index e4a6012a9..4f1b654b2 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -24,7 +24,7 @@ {{ template "_internal/opengraph.html" . -}} {{ template "_internal/schema.html" . -}} {{ template "_internal/twitter_cards.html" . -}} -{{ partialCached "head-css.html" . "asdf" -}} +{{ partialCached "head-css.html" . "head-css-cache-key" }}