mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
b718d743b7
commit
88e447c449
2 changed files with 20 additions and 2 deletions
|
@ -114,7 +114,7 @@ func TestSCSSWithThemeOverrides(t *testing.T) {
|
||||||
|
|
||||||
b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_imports.scss"), `
|
b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_imports.scss"), `
|
||||||
@import "moo";
|
@import "moo";
|
||||||
|
@import "_boo";
|
||||||
`)
|
`)
|
||||||
|
|
||||||
b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_moo.scss"), `
|
b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_moo.scss"), `
|
||||||
|
@ -123,6 +123,14 @@ $moolor: #fff;
|
||||||
moo {
|
moo {
|
||||||
color: $moolor;
|
color: $moolor;
|
||||||
}
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_boo.scss"), `
|
||||||
|
$boolor: orange;
|
||||||
|
|
||||||
|
boo {
|
||||||
|
color: $boolor;
|
||||||
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
b.WithSourceFile(filepath.Join(scssThemeDir, "main.scss"), `
|
b.WithSourceFile(filepath.Join(scssThemeDir, "main.scss"), `
|
||||||
|
@ -136,6 +144,14 @@ $moolor: #ccc;
|
||||||
moo {
|
moo {
|
||||||
color: $moolor;
|
color: $moolor;
|
||||||
}
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
b.WithSourceFile(filepath.Join(scssDir, "components", "_boo.scss"), `
|
||||||
|
$boolor: green;
|
||||||
|
|
||||||
|
boo {
|
||||||
|
color: $boolor;
|
||||||
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
b.WithTemplatesAdded("index.html", `
|
b.WithTemplatesAdded("index.html", `
|
||||||
|
@ -145,7 +161,7 @@ T1: {{ $r.Content }}
|
||||||
`)
|
`)
|
||||||
b.Build(BuildCfg{})
|
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}`)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,8 @@ func (t *toCSSTransformation) Transform(ctx *resource.ResourceTransformationCtx)
|
||||||
namePatterns = []string{"_%s.scss", "%s.scss", "_%s.sass", "%s.sass"}
|
namePatterns = []string{"_%s.scss", "%s.scss", "_%s.sass", "%s.sass"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name = strings.TrimPrefix(name, "_")
|
||||||
|
|
||||||
for _, namePattern := range namePatterns {
|
for _, namePattern := range namePatterns {
|
||||||
filenameToCheck := filepath.Join(basePath, fmt.Sprintf(namePattern, name))
|
filenameToCheck := filepath.Join(basePath, fmt.Sprintf(namePattern, name))
|
||||||
fi, err := t.c.sfs.Fs.Stat(filenameToCheck)
|
fi, err := t.c.sfs.Fs.Stat(filenameToCheck)
|
||||||
|
|
Loading…
Reference in a new issue