aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl/resources
diff options
context:
space:
mode:
authorJoe Mooring <[email protected]>2024-10-18 16:10:46 -0700
committerBjørn Erik Pedersen <[email protected]>2024-11-01 14:05:27 +0100
commit889308dd854b0907069d7bc6dd44ed760bc6e819 (patch)
tree71208681d828904c97b876ee517065d22d2bd002 /tpl/resources
parent72352f205afeef8310dcc276fc7a72db311a1621 (diff)
downloadhugo-889308dd854b0907069d7bc6dd44ed760bc6e819.tar.gz
hugo-889308dd854b0907069d7bc6dd44ed760bc6e819.zip
resources: Address Dart Sass deprecation of global built-in functions
See https://github.com/sass/dart-sass/releases/tag/1.80.0 Fixes #12961
Diffstat (limited to 'tpl/resources')
-rw-r--r--tpl/resources/resources_integration_test.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/tpl/resources/resources_integration_test.go b/tpl/resources/resources_integration_test.go
index cfd03dc73..563b3c455 100644
--- a/tpl/resources/resources_integration_test.go
+++ b/tpl/resources/resources_integration_test.go
@@ -18,6 +18,8 @@ import (
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/hugolib"
+ "github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass"
+ "github.com/gohugoio/hugo/resources/resource_transformers/tocss/scss"
)
func TestCopy(t *testing.T) {
@@ -238,3 +240,45 @@ match /files/C*: 2|
b.AssertFileContent("public/files/b.txt", "I am b.txt")
b.AssertFileContent("public/files/C.txt", "I am C.txt")
}
+
+// Issue #12961
+func TestDartSassVars(t *testing.T) {
+ t.Parallel()
+
+ if !scss.Supports() || !dartsass.Supports() {
+ t.Skip()
+ }
+
+ files := `
+-- hugo.toml --
+disableKinds = ['page','section','rss','sitemap','taxonomy','term']
+-- layouts/index.html --
+{{ $opts := dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" (dict "color" "red") }}
+{{ with resources.Get "dartsass.scss" | css.Sass $opts }}
+ {{ .Content }}
+{{ end }}
+
+{{ $opts := dict "transpiler" "libsass" "outputStyle" "compressed" "vars" (dict "color" "blue") }}
+{{ with resources.Get "libsass.scss" | css.Sass $opts }}
+ {{ .Content }}
+{{ end }}
+-- assets/dartsass.scss --
+@use "hugo:vars" as v;
+.dartsass {
+ color: v.$color;
+}
+-- assets/libsass.scss --
+@import "hugo:vars";
+.libsass {
+ color: $color;
+}
+`
+
+ b := hugolib.Test(t, files, hugolib.TestOptWarn())
+
+ b.AssertFileContent("public/index.html",
+ ".dartsass{color:red}",
+ ".libsass{color:blue}",
+ )
+ b.AssertLogContains("! WARN Dart Sass: hugo:vars")
+}