diff --git a/hugo.toml b/hugo.toml index e316dba..86bc680 100644 --- a/hugo.toml +++ b/hugo.toml @@ -36,6 +36,7 @@ js_bundle_name = "hb" logo = "/images/logo.png" color = "light" # default color mode, light or dark. sass_transpiler = "dartsass" # dartsass or libsass (deprecated). +sass_silence_deprecations = ["import", "global-builtin", "color-functions"] [params.hb.styles] prefix = "hb-" # CSS variables prefix. diff --git a/layouts/partials/hb/assets/css-resource.html b/layouts/partials/hb/assets/css-resource.html index 9d4e72b..d224984 100644 --- a/layouts/partials/hb/assets/css-resource.html +++ b/layouts/partials/hb/assets/css-resource.html @@ -1,3 +1,4 @@ +{{- $debug := partialCached "hb/functions/debug" . }} {{- $dirs := slice "" }} {{/* Check if there is RTL site. */}} {{- if where site.Sites "Language.LanguageDirection" "rtl" }} @@ -16,6 +17,12 @@ {{/* SCSS options. */}} {{- $options := dict "transpiler" (default "dartsass" $params.hb.sass_transpiler) + "silenceDeprecations" ( + cond + $debug + slice + (default slice $params.hb.sass_silence_deprecations) + ) "targetPath" (printf "css/%s%s.css" $bundle $suffix) "enableSourceMap" hugo.IsProduction "vars" site.Params.hb.styles @@ -29,7 +36,7 @@ {{- $tmpl := resources.Get "hb/scss/index.tmpl.scss" }} {{/* Compile SCSS. The target path MUST begin with "hb/scss/*" for resolving SASS/SCSS modules. */}} {{- $style := $tmpl | resources.ExecuteAsTemplate (printf "hb/scss/index%s.scss" $suffix) $context }} - {{- if partialCached "hb/functions/debug" . }} + {{- if $debug }} {{- warnf "[hb] %s:\n%s\n" $style.Name $style.Content }} {{- end }} {{- $style = $style | toCSS $options }}