summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-08-23 21:53:46 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-08-23 22:50:35 +0200
commitebaa733d45b415d196358a6adbaf02c287b4ba36 (patch)
treee66b7b41b309d1ae6bd09bef46651e2f271802d3 /commands
parent24b1be45c17d68c67bab61b2fbb568f53a3d8202 (diff)
Make sure resources directory isn't created in hugo new theme
Fixes #11382
Diffstat (limited to 'commands')
-rw-r--r--commands/new.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/commands/new.go b/commands/new.go
index 3f43a687f..ffd75b2bb 100644
--- a/commands/new.go
+++ b/commands/new.go
@@ -20,6 +20,7 @@ import (
"strings"
"github.com/bep/simplecobra"
+ "github.com/gohugoio/hugo/common/paths"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/create"
"github.com/gohugoio/hugo/create/skeletons"
@@ -120,14 +121,15 @@ according to your needs.`,
if len(args) < 1 {
return newUserError("theme name needs to be provided")
}
- h, err := r.Hugo(flagsToCfg(cd, nil))
+ cfg := config.New()
+ cfg.Set("publishDir", "public")
+
+ conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, cfg))
if err != nil {
return err
}
- ps := h.PathSpec
- sourceFs := ps.Fs.Source
- themesDir := h.Configs.LoadingInfo.BaseConfig.ThemesDir
- createpath := ps.AbsPathify(filepath.Join(themesDir, args[0]))
+ sourceFs := conf.fs.Source
+ createpath := paths.AbsPathify(conf.configs.Base.WorkingDir, filepath.Join(conf.configs.Base.ThemesDir, args[0]))
r.Println("Creating new theme in", createpath)
err = skeletons.CreateTheme(createpath, sourceFs)