mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-26 22:04:32 +02:00
dartsass: Enable deprecation, @warn and @debug logging
* @warn and Sass deprecations are printed as WARN * @debug is currently logged as INFO (needs the `--verbose` flag). We may adjust this if it gets too chatty. Fixes #9683
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
|
||||
"github.com/gohugoio/hugo/hugolib"
|
||||
"github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
|
||||
func TestTransformIncludePaths(t *testing.T) {
|
||||
@@ -164,3 +165,34 @@ zoo {
|
||||
|
||||
b.AssertFileContent("public/index.html", `T1: moo{color:#ccc}boo{color:green}zoo{color:pink}`)
|
||||
}
|
||||
|
||||
func TestTransformLogging(t *testing.T) {
|
||||
if !dartsass.Supports() {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
files := `
|
||||
-- assets/scss/main.scss --
|
||||
@warn "foo";
|
||||
@debug "bar";
|
||||
|
||||
-- config.toml --
|
||||
disableKinds = ["term", "taxonomy", "section", "page"]
|
||||
-- layouts/index.html --
|
||||
{{ $cssOpts := (dict "transpiler" "dartsass" ) }}
|
||||
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }}
|
||||
T1: {{ $r.Content }}
|
||||
`
|
||||
|
||||
b := hugolib.NewIntegrationTestBuilder(
|
||||
hugolib.IntegrationTestConfig{
|
||||
T: t,
|
||||
TxtarString: files,
|
||||
NeedsOsFS: true,
|
||||
LogLevel: jww.LevelInfo,
|
||||
}).Build()
|
||||
|
||||
b.AssertLogMatches(`WARN.*Dart Sass: foo`)
|
||||
b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:1:0: bar`)
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user