Skip to content

Commit

Permalink
feat: add the hb.sass_silence_deprecations parameter to silence dep…
Browse files Browse the repository at this point in the history
…recations from Dart Sass (#280)
  • Loading branch information
razonyang authored Nov 24, 2024
1 parent 8385b09 commit 02d49a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion layouts/partials/hb/assets/css-resource.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $debug := partialCached "hb/functions/debug" . }}
{{- $dirs := slice "" }}
{{/* Check if there is RTL site. */}}
{{- if where site.Sites "Language.LanguageDirection" "rtl" }}
Expand All @@ -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
Expand All @@ -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 }}
Expand Down

0 comments on commit 02d49a0

Please sign in to comment.