mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
modules: Allow absolute paths for any modules resolved via project replacement
Fixes #8240
This commit is contained in:
parent
4ffaeaf155
commit
3a5ee0d2d6
2 changed files with 9 additions and 7 deletions
|
@ -276,7 +276,7 @@ func (c *collector) add(owner *moduleAdapter, moduleImport Import, disabled bool
|
||||||
// Fall back to project/themes/<mymodule>
|
// Fall back to project/themes/<mymodule>
|
||||||
if moduleDir == "" {
|
if moduleDir == "" {
|
||||||
var err error
|
var err error
|
||||||
moduleDir, err = c.createThemeDirname(modulePath, owner.projectMod)
|
moduleDir, err = c.createThemeDirname(modulePath, owner.projectMod || moduleImport.pathProjectReplaced)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.err = err
|
c.err = err
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
|
@ -237,6 +237,7 @@ func decodeConfig(cfg config.Provider, pathReplacements map[string]string) (Conf
|
||||||
for i, imp := range c.Imports {
|
for i, imp := range c.Imports {
|
||||||
if newImp, found := c.replacementsMap[imp.Path]; found {
|
if newImp, found := c.replacementsMap[imp.Path]; found {
|
||||||
imp.Path = newImp
|
imp.Path = newImp
|
||||||
|
imp.pathProjectReplaced = true
|
||||||
c.Imports[i] = imp
|
c.Imports[i] = imp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,12 +356,13 @@ func (v HugoVersion) IsValid() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Import struct {
|
type Import struct {
|
||||||
Path string // Module path
|
Path string // Module path
|
||||||
IgnoreConfig bool // Ignore any config in config.toml (will still folow imports).
|
pathProjectReplaced bool // Set when Path is replaced in project config.
|
||||||
IgnoreImports bool // Do not follow any configured imports.
|
IgnoreConfig bool // Ignore any config in config.toml (will still folow imports).
|
||||||
NoVendor bool // Never vendor this import (only allowed in main project).
|
IgnoreImports bool // Do not follow any configured imports.
|
||||||
Disable bool // Turn off this module.
|
NoVendor bool // Never vendor this import (only allowed in main project).
|
||||||
Mounts []Mount
|
Disable bool // Turn off this module.
|
||||||
|
Mounts []Mount
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mount struct {
|
type Mount struct {
|
||||||
|
|
Loading…
Reference in a new issue