Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-07-18 12:02:21 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-07-18 12:39:04 +0300
commit5c9d5413a4e2cc8d44a8b2d7dff04e6523ba2a29 (patch)
treeb714ff456b2f216310e225829f8fe70f5e9a1c62 /hugolib
parent59ebc83d72b09d28d62d8600517c73a4ffe70c66 (diff)
hugolib/filesystems: Fix theme config for Work Fs
Which was the reason why `PostCSS´ from theme(s) was not picked up. Fixes #4951
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/filesystems/basefs.go5
-rw-r--r--hugolib/filesystems/basefs_test.go12
2 files changed, 16 insertions, 1 deletions
diff --git a/hugolib/filesystems/basefs.go b/hugolib/filesystems/basefs.go
index 1a99da17b..731b5a195 100644
--- a/hugolib/filesystems/basefs.go
+++ b/hugolib/filesystems/basefs.go
@@ -407,6 +407,11 @@ func (b *sourceFilesystemsBuilder) createFs(
s := &SourceFilesystem{
SourceFs: b.p.Fs.Source,
}
+
+ if themeFolder == "" {
+ themeFolder = filePathSeparator
+ }
+
var dir string
if dirKey != "" {
dir = b.p.Cfg.GetString(dirKey)
diff --git a/hugolib/filesystems/basefs_test.go b/hugolib/filesystems/basefs_test.go
index c4da0be83..62a589550 100644
--- a/hugolib/filesystems/basefs_test.go
+++ b/hugolib/filesystems/basefs_test.go
@@ -50,8 +50,14 @@ func TestNewBaseFs(t *testing.T) {
fs.Source.Mkdir(base, 0755)
afero.WriteFile(fs.Source, filepath.Join(base, fmt.Sprintf("theme-file-%s-%s.txt", theme, dir)), []byte(fmt.Sprintf("content:%s:%s", theme, dir)), 0755)
}
+ // Write some files to the root of the theme
+ base := filepath.Join(workingDir, "themes", theme)
+ afero.WriteFile(fs.Source, filepath.Join(base, fmt.Sprintf("theme-root-%s.txt", theme)), []byte(fmt.Sprintf("content:%s", theme)), 0755)
+ afero.WriteFile(fs.Source, filepath.Join(base, "file-root.txt"), []byte(fmt.Sprintf("content:%s", theme)), 0755)
}
+ afero.WriteFile(fs.Source, filepath.Join(workingDir, "file-root.txt"), []byte("content-project"), 0755)
+
afero.WriteFile(fs.Source, filepath.Join(workingDir, "themes", "btheme", "config.toml"), []byte(`
theme = ["atheme"]
`), 0755)
@@ -102,7 +108,7 @@ theme = ["atheme"]
checkFileCount(bfs.Archetypes.Fs, "", assert, 8)
checkFileCount(bfs.Assets.Fs, "", assert, 9)
checkFileCount(bfs.Resources.Fs, "", assert, 10)
- checkFileCount(bfs.Work.Fs, "", assert, 57)
+ checkFileCount(bfs.Work.Fs, "", assert, 69)
assert.Equal([]string{filepath.FromSlash("/my/work/mydata"), filepath.FromSlash("/my/work/themes/btheme/data"), filepath.FromSlash("/my/work/themes/atheme/data")}, bfs.Data.Dirnames)
@@ -117,6 +123,10 @@ theme = ["atheme"]
rel := bfs.RelContentDir(contentFilename)
assert.Equal("file1.txt", rel)
+ // Check Work fs vs theme
+ checkFileContent(bfs.Work.Fs, "file-root.txt", assert, "content-project")
+ checkFileContent(bfs.Work.Fs, "theme-root-atheme.txt", assert, "content:atheme")
+
}
func createConfig() *viper.Viper {