From f9b4eb4f3968d32f45e0168c854e6b0c7f3a90b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 23 Nov 2018 09:16:42 +0100 Subject: Handle themes in the new file cache (for images, assets) In the newly consolidated file cache implementation, we forgot that we also look in the theme(s) for assets (SCSS transformations etc.), which is not good for Netlify and the demo sites. Fixes #5460 --- tpl/data/resources_test.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'tpl/data') diff --git a/tpl/data/resources_test.go b/tpl/data/resources_test.go index 4a5482fdb..d1091b23f 100644 --- a/tpl/data/resources_test.go +++ b/tpl/data/resources_test.go @@ -23,13 +23,12 @@ import ( "testing" "time" - "github.com/gohugoio/hugo/hugolib/paths" + "github.com/gohugoio/hugo/helpers" "github.com/gohugoio/hugo/cache/filecache" "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/config" "github.com/gohugoio/hugo/deps" - "github.com/gohugoio/hugo/helpers" "github.com/gohugoio/hugo/hugofs" "github.com/gohugoio/hugo/langs" "github.com/spf13/afero" @@ -181,6 +180,12 @@ func TestScpGetRemoteParallel(t *testing.T) { func newDeps(cfg config.Provider) *deps.Deps { cfg.Set("resourceDir", "resources") + cfg.Set("dataDir", "resources") + cfg.Set("i18nDir", "i18n") + cfg.Set("assetDir", "assets") + cfg.Set("layoutDir", "layouts") + cfg.Set("archetypeDir", "archetypes") + l := langs.NewLanguage("en", cfg) l.Set("i18nDir", "i18n") cs, err := helpers.NewContentSpec(l) @@ -190,9 +195,13 @@ func newDeps(cfg config.Provider) *deps.Deps { fs := hugofs.NewMem(l) logger := loggers.NewErrorLogger() - p, _ := paths.New(fs, cfg) - fileCaches, err := filecache.NewCachesFromPaths(p) + p, err := helpers.NewPathSpec(fs, cfg) + if err != nil { + panic(err) + } + + fileCaches, err := filecache.NewCaches(p) if err != nil { panic(err) } -- cgit v1.2.3