summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hugolib/resource_chain_test.go20
-rw-r--r--resource/tocss/scss/tocss.go2
2 files changed, 20 insertions, 2 deletions
diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go
index 3d13d3912..3e199d318 100644
--- a/hugolib/resource_chain_test.go
+++ b/hugolib/resource_chain_test.go
@@ -114,7 +114,7 @@ func TestSCSSWithThemeOverrides(t *testing.T) {
b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_imports.scss"), `
@import "moo";
-
+@import "_boo";
`)
b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_moo.scss"), `
@@ -125,6 +125,14 @@ moo {
}
`)
+ b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_boo.scss"), `
+$boolor: orange;
+
+boo {
+ color: $boolor;
+}
+`)
+
b.WithSourceFile(filepath.Join(scssThemeDir, "main.scss"), `
@import "components/imports";
@@ -138,6 +146,14 @@ moo {
}
`)
+ b.WithSourceFile(filepath.Join(scssDir, "components", "_boo.scss"), `
+$boolor: green;
+
+boo {
+ color: $boolor;
+}
+`)
+
b.WithTemplatesAdded("index.html", `
{{ $cssOpts := (dict "includePaths" (slice "node_modules/foo" ) ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts | minify }}
@@ -145,7 +161,7 @@ T1: {{ $r.Content }}
`)
b.Build(BuildCfg{})
- b.AssertFileContent(filepath.Join(workDir, "public/index.html"), `T1: moo{color:#ccc}`)
+ b.AssertFileContent(filepath.Join(workDir, "public/index.html"), `T1: moo{color:#ccc}boo{color:green}`)
}
diff --git a/resource/tocss/scss/tocss.go b/resource/tocss/scss/tocss.go
index c50b054b7..5ba7793c0 100644
--- a/resource/tocss/scss/tocss.go
+++ b/resource/tocss/scss/tocss.go
@@ -93,6 +93,8 @@ func (t *toCSSTransformation) Transform(ctx *resource.ResourceTransformationCtx)
namePatterns = []string{"_%s.scss", "%s.scss", "_%s.sass", "%s.sass"}
}
+ name = strings.TrimPrefix(name, "_")
+
for _, namePattern := range namePatterns {
filenameToCheck := filepath.Join(basePath, fmt.Sprintf(namePattern, name))
fi, err := t.c.sfs.Fs.Stat(filenameToCheck)