diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-03-01 14:42:56 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-03-01 17:10:13 +0100 |
commit | 2b2f2b75eff43ea3536350fa5a2c9ebbc1723ba8 (patch) | |
tree | 6606e04c1b64785beeed640da0edd8ea135e6085 /hugolib | |
parent | 0d6e593ffb65a67206caa3c3071d94694cfc2183 (diff) | |
download | hugo-2b2f2b75eff43ea3536350fa5a2c9ebbc1723ba8.tar.gz hugo-2b2f2b75eff43ea3536350fa5a2c9ebbc1723ba8.zip |
hugofs: Fix vertical mount merge issue
Fixes #12175
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/filesystems/basefs_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/hugolib/filesystems/basefs_test.go b/hugolib/filesystems/basefs_test.go index 4fdeba765..10b4a4cb2 100644 --- a/hugolib/filesystems/basefs_test.go +++ b/hugolib/filesystems/basefs_test.go @@ -509,6 +509,40 @@ l2 } } +func TestAssetsIssue12175(t *testing.T) { + files := ` +-- hugo.toml -- +baseURL = "https://example.com/" +[module] +[[module.mounts]] +source = "node_modules/@foo/core/assets" +target = "assets" +[[module.mounts]] +source = "assets" +target = "assets" +-- node_modules/@foo/core/assets/js/app.js -- +JS. +-- node_modules/@foo/core/assets/scss/app.scss -- +body { color: red; } +-- assets/scss/app.scss -- +body { color: blue; } +-- layouts/index.html -- +Home. +SCSS: {{ with resources.Get "scss/app.scss" }}{{ .RelPermalink }}|{{ .Content }}{{ end }}| +# Note that the pattern below will match 2 resources, which doesn't make much sense, +# but is how the current (and also < v0.123.0) merge logic works, and for most practical purposes, it doesn't matter. +SCSS Match: {{ with resources.Match "**.scss" }}{{ . | len }}|{{ range .}}{{ .RelPermalink }}|{{ end }}{{ end }}| + +` + + b := hugolib.Test(t, files) + + b.AssertFileContent("public/index.html", ` +SCSS: /scss/app.scss|body { color: blue; }| +SCSS Match: 2| +`) +} + func TestStaticComposite(t *testing.T) { files := ` -- hugo.toml -- |