Closed canstand closed 1 year ago
This works (I have removed the replacement part, which I don't think is important here):
baseURL = 'https://example.org/'
languageCode = 'en-us'
title = 'My New Hugo Site'
[build]
_merge = 'deep'
[module]
_merge = 'shallow'
[[module.imports]]
path = 'github.com/bep/hugo-starter-tailwind-basic/v3'
[[module.imports.mounts]]
source = "assets"
target = "assets"
[[module.imports.mounts]]
source = "content"
target = "content"
[[module.imports.mounts]]
source = "static"
target = "static"
[[module.imports.mounts]]
source = "layouts"
target = "layouts"
[[module.imports.mounts]]
source = "data"
target = "data"
[[module.imports.mounts]]
source = "i18n"
target = "i18n"
[[module.imports.mounts]]
source = "archetypes"
target = "archetypes"
Note the placement of the mounts below the import, also the important assets
mount where the CSS lives.
But note:
replacements
config was added before Go's workspace support; now I would recommend that you set up your development with work files, see https://gohugo.io/hugo-modules/use-modules/#module-workspacesThis only solves the first issue. Let's use my theme for testing, which is more intuitive.. (Note, run in WSL2, ubuntu 22.04.3)
Run the script, and the page will display as follows
#!/usr/bin/env bash
# remove dir for new test
rm -rf ./hugotest
hugo new site hugotest
cd hugotest
hugo mod init hugotest
cat >> hugo.toml<< EOF
[build]
_merge = 'deep'
[module]
_merge = 'shallow'
[[module.imports]]
path = 'github.com/canstand/compost'
EOF
hugo mod npm pack
npm install
hugo server -logLevel debug
No need to make any changes, just press Ctrl+C
to exit, then cd hugotest; hugo server
, and refresh the page, it's back to normal.
But, If you replace _merge = 'shallow'
in the script with the specific config, there will be no such issue.
[[module.mounts]]
source = "assets"
target = "assets"
[[module.mounts]]
source = "hugo_stats.json"
target = "assets/watching/hugo_stats.json"
Yea, OK, now I get it. What you see is the
[[module.mounts]]
source = 'hugo_stats.json'
target = 'assets/watching/hugo_stats.json'
Not considered to be a "watch candidate" when coming from a module. So, the configuration merge works, but I suspect it's a ordering "thing" where we evaluate the watch directories based on the project config only (not sure what, someone needs to look at the code).
OK, now I think I understand.
Running this locally, the mount assets/watching/hugo_stats.json
mounts to /Users/bep/Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/github.com/canstand/compost@v0.6.1/hugo_stats.json
To cut a long story short:
_merge
) doesn't (to me) make a whole lot of sense.Anyhow, you need to move the hugo_stats mount to the project config.
Thanks, now I understand, I need to guide the theme users to explicitly configure mounts
, not merge
.
Thanks.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
What version of Hugo are you using (
hugo version
)?v0.117.0
Does this issue reproduce with the latest release?
yes
Reproduce with the following steps:
rm -rf ./hugotest hugo new site hugotest cd hugotest hugo mod init hugotest
cat >> hugo.toml<< EOF [build] _merge = 'deep' [module] _merge = 'shallow' replacements = 'github.com/bep/hugo-starter-tailwind-basic/v3 -> ../../hugo-starter-tailwind-basic' [[module.imports]] path = 'github.com/bep/hugo-starter-tailwind-basic/v3' EOF
hugo mod npm pack npm install hugo server -logLevel debug
hugo server
, so that the page style can be displayed correctly.hugo server
for a new site (with merge module), don't know why