Skip to content

Commit

Permalink
commands: Only watch relevant themes dir
Browse files Browse the repository at this point in the history
The same behavior as for the root project.

Fixes gohugoio#2602
  • Loading branch information
bep authored and tychoish committed Aug 13, 2017
1 parent 2061253 commit c8a24fd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion commands/hugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,12 @@ func getDirList() []string {
i18nDir := helpers.AbsPathify(viper.GetString("I18nDir"))
layoutDir := helpers.AbsPathify(viper.GetString("LayoutDir"))
staticDir := helpers.AbsPathify(viper.GetString("StaticDir"))
var themesDir string

if helpers.ThemeSet() {
themesDir = helpers.AbsPathify(viper.GetString("themesDir") + "/" + viper.GetString("theme"))
}

walker := func(path string, fi os.FileInfo, err error) error {
if err != nil {
if path == dataDir && os.IsNotExist(err) {
Expand Down Expand Up @@ -628,9 +634,14 @@ func getDirList() []string {
helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("ContentDir")), walker)
helpers.SymbolicWalk(hugofs.Source(), i18nDir, walker)
helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("LayoutDir")), walker)

helpers.SymbolicWalk(hugofs.Source(), staticDir, walker)
if helpers.ThemeSet() {
helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("themesDir")+"/"+viper.GetString("theme")), walker)
helpers.SymbolicWalk(hugofs.Source(), filepath.Join(themesDir, "layouts"), walker)
helpers.SymbolicWalk(hugofs.Source(), filepath.Join(themesDir, "static"), walker)
helpers.SymbolicWalk(hugofs.Source(), filepath.Join(themesDir, "i18n"), walker)
helpers.SymbolicWalk(hugofs.Source(), filepath.Join(themesDir, "data"), walker)

}

return a
Expand Down

0 comments on commit c8a24fd

Please sign in to comment.