Skip to content

Commit

Permalink
modules: Allow absolute paths for any modules resolved via project re…
Browse files Browse the repository at this point in the history
…placement

Fixes #8240
  • Loading branch information
bep committed Feb 15, 2021
1 parent 4ffaeaf commit 3a5ee0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion modules/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (c *collector) add(owner *moduleAdapter, moduleImport Import, disabled bool
// Fall back to project/themes/<mymodule>
if moduleDir == "" {
var err error
moduleDir, err = c.createThemeDirname(modulePath, owner.projectMod)
moduleDir, err = c.createThemeDirname(modulePath, owner.projectMod || moduleImport.pathProjectReplaced)
if err != nil {
c.err = err
return nil, nil
Expand Down
14 changes: 8 additions & 6 deletions modules/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ func decodeConfig(cfg config.Provider, pathReplacements map[string]string) (Conf
for i, imp := range c.Imports {
if newImp, found := c.replacementsMap[imp.Path]; found {
imp.Path = newImp
imp.pathProjectReplaced = true
c.Imports[i] = imp
}
}
Expand Down Expand Up @@ -355,12 +356,13 @@ func (v HugoVersion) IsValid() bool {
}

type Import struct {
Path string // Module path
IgnoreConfig bool // Ignore any config in config.toml (will still folow imports).
IgnoreImports bool // Do not follow any configured imports.
NoVendor bool // Never vendor this import (only allowed in main project).
Disable bool // Turn off this module.
Mounts []Mount
Path string // Module path
pathProjectReplaced bool // Set when Path is replaced in project config.
IgnoreConfig bool // Ignore any config in config.toml (will still folow imports).
IgnoreImports bool // Do not follow any configured imports.
NoVendor bool // Never vendor this import (only allowed in main project).
Disable bool // Turn off this module.
Mounts []Mount
}

type Mount struct {
Expand Down

0 comments on commit 3a5ee0d

Please sign in to comment.