mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Make sure resources directory isn't created in hugo new theme
Fixes #11382
This commit is contained in:
parent
24b1be45c1
commit
ebaa733d45
3 changed files with 9 additions and 5 deletions
|
@ -20,6 +20,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/bep/simplecobra"
|
"github.com/bep/simplecobra"
|
||||||
|
"github.com/gohugoio/hugo/common/paths"
|
||||||
"github.com/gohugoio/hugo/config"
|
"github.com/gohugoio/hugo/config"
|
||||||
"github.com/gohugoio/hugo/create"
|
"github.com/gohugoio/hugo/create"
|
||||||
"github.com/gohugoio/hugo/create/skeletons"
|
"github.com/gohugoio/hugo/create/skeletons"
|
||||||
|
@ -120,14 +121,15 @@ according to your needs.`,
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
return newUserError("theme name needs to be provided")
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ps := h.PathSpec
|
sourceFs := conf.fs.Source
|
||||||
sourceFs := ps.Fs.Source
|
createpath := paths.AbsPathify(conf.configs.Base.WorkingDir, filepath.Join(conf.configs.Base.ThemesDir, args[0]))
|
||||||
themesDir := h.Configs.LoadingInfo.BaseConfig.ThemesDir
|
|
||||||
createpath := ps.AbsPathify(filepath.Join(themesDir, args[0]))
|
|
||||||
r.Println("Creating new theme in", createpath)
|
r.Println("Creating new theme in", createpath)
|
||||||
|
|
||||||
err = skeletons.CreateTheme(createpath, sourceFs)
|
err = skeletons.CreateTheme(createpath, sourceFs)
|
||||||
|
|
|
@ -16,11 +16,13 @@ exists i18n
|
||||||
exists layouts
|
exists layouts
|
||||||
exists static
|
exists static
|
||||||
exists themes
|
exists themes
|
||||||
|
! exists resources
|
||||||
|
|
||||||
hugo new theme -h
|
hugo new theme -h
|
||||||
stdout 'Create a new theme \(skeleton\) called \[name\] in ./themes'
|
stdout 'Create a new theme \(skeleton\) called \[name\] in ./themes'
|
||||||
hugo new theme mytheme
|
hugo new theme mytheme
|
||||||
stdout 'Creating new theme'
|
stdout 'Creating new theme'
|
||||||
|
! exists resources
|
||||||
cd themes
|
cd themes
|
||||||
cd mytheme
|
cd mytheme
|
||||||
checkfile archetypes/default.md
|
checkfile archetypes/default.md
|
Loading…
Reference in a new issue