github.com/bep/gitmap v1.6.0/go.mod h1:n+3W1f/rot2hynsqEGxGMErPRgT41n9CkGuzPvz9cIw=
github.com/bep/goat v0.5.0 h1:S8jLXHCVy/EHIoCY+btKkmcxcXFd34a0Q63/0D4TKeA=
github.com/bep/goat v0.5.0/go.mod h1:Md9x7gRxiWKs85yHlVTvHQw9rg86Bm+Y4SuYE8CTH7c=
-github.com/bep/godartsass/v2 v2.4.1 h1:ktbimHvS+FUZ2FQsSEqm5DDfKnr56DVf7GNWuIbA1M8=
-github.com/bep/godartsass/v2 v2.4.1/go.mod h1:rjsi1YSXAl/UbsGL85RLDEjRKdIKUlMQHr6ChUNYOFU=
+github.com/bep/godartsass/v2 v2.5.0 h1:tKRvwVdyjCIr48qgtLa4gHEdtRkPF8H1OeEhJAEv7xg=
+github.com/bep/godartsass/v2 v2.5.0/go.mod h1:rjsi1YSXAl/UbsGL85RLDEjRKdIKUlMQHr6ChUNYOFU=
github.com/bep/golibsass v1.2.0 h1:nyZUkKP/0psr8nT6GR2cnmt99xS93Ji82ZD9AgOK6VI=
github.com/bep/golibsass v1.2.0/go.mod h1:DL87K8Un/+pWUS75ggYv41bliGiolxzDKWJAq3eJ1MA=
github.com/bep/goportabletext v0.1.0 h1:8dqym2So1cEqVZiBa4ZnMM1R9l/DnC1h4ONg4J5kujw=
b.AssertLogContains("! Dart Sass: DEPRECATED [import]")
b.AssertFileContent("public/index.html", `moo{color:#fff}`)
}
+
+func TestSilenceDependencyDeprecations(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+disableKinds = ['page','rss','section','sitemap','taxonomy','term']
+-- layouts/index.html --
+{{ $opts := dict
+ "transpiler" "dartsass"
+ "outputStyle" "compressed"
+ "includePaths" (slice "node_modules")
+ KVPAIR
+}}
+{{ (resources.Get "sass/main.scss" | css.Sass $opts).Content }}
+-- assets/sass/main.scss --
+@use "sass:color";
+@use "foo/deprecated.scss";
+h3 { color: rgb(color.channel(#ccc, "red", $space: rgb), 0, 0); }
+// COMMENT
+-- node_modules/foo/deprecated.scss --
+@use "sass:color";
+h1 { color: rgb(color.channel(#eee, "red", $space: rgb), 0, 0); }
+h2 { color: rgb(color.red(#ddd), 0, 0); } // deprecated
+`
+
+ expectedCSS := "h1{color:#e00}h2{color:#d00}h3{color:#c00}"
+
+ // Do not silence dependency deprecation warnings (default).
+ f := strings.ReplaceAll(files, "KVPAIR", "")
+ b := hugolib.Test(t, f, hugolib.TestOptWarn(), hugolib.TestOptOsFs())
+ b.AssertFileContent("public/index.html", expectedCSS)
+ b.AssertLogContains(
+ "WARN Dart Sass: DEPRECATED [color-functions]",
+ "color.red() is deprecated",
+ )
+
+ // Do not silence dependency deprecation warnings (explicit).
+ f = strings.ReplaceAll(files, "KVPAIR", `"silenceDependencyDeprecations" false`)
+ b = hugolib.Test(t, f, hugolib.TestOptWarn(), hugolib.TestOptOsFs())
+ b.AssertFileContent("public/index.html", expectedCSS)
+ b.AssertLogContains(
+ "WARN Dart Sass: DEPRECATED [color-functions]",
+ "color.red() is deprecated",
+ )
+
+ // Silence dependency deprecation warnings.
+ f = strings.ReplaceAll(files, "KVPAIR", `"silenceDependencyDeprecations" true`)
+ b = hugolib.Test(t, f, hugolib.TestOptWarn(), hugolib.TestOptOsFs())
+ b.AssertFileContent("public/index.html", expectedCSS)
+ b.AssertLogContains("! WARN")
+
+ // Make sure that we are not silencing non-dependency deprecation warnings.
+ f = strings.ReplaceAll(files, "KVPAIR", `"silenceDependencyDeprecations" true`)
+ f = strings.ReplaceAll(f, "// COMMENT", "h4 { color: rgb(0, color.green(#bbb), 0); }")
+ b = hugolib.Test(t, f, hugolib.TestOptWarn(), hugolib.TestOptOsFs())
+ b.AssertFileContent("public/index.html", expectedCSS+"h4{color:#0b0}")
+ b.AssertLogContains(
+ "WARN Dart Sass: DEPRECATED [color-functions]",
+ "color.green() is deprecated",
+ )
+}
varsStylesheet: godartsass.Import{Content: sass.CreateVarsStyleSheet(sass.TranspilerDart, opts.Vars)},
},
- OutputStyle: godartsass.ParseOutputStyle(opts.OutputStyle),
- EnableSourceMap: opts.EnableSourceMap,
- SourceMapIncludeSources: opts.SourceMapIncludeSources,
- SilenceDeprecations: opts.SilenceDeprecations,
+ OutputStyle: godartsass.ParseOutputStyle(opts.OutputStyle),
+ EnableSourceMap: opts.EnableSourceMap,
+ SourceMapIncludeSources: opts.SourceMapIncludeSources,
+ SilenceDeprecations: opts.SilenceDeprecations,
+ SilenceDependencyDeprecations: opts.SilenceDependencyDeprecations,
}
// Append any workDir relative include paths