summaryrefslogtreecommitdiffstats
path: root/hugolib/resource_chain_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-07-12 15:19:54 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-07-12 19:36:12 +0200
commitbeec1fc98e5d37bba742d6bc2a0ff7c344b469f8 (patch)
treebe435ef05d24a14d83279787c1f9254d34a91e8a /hugolib/resource_chain_test.go
parent306573def0e20ec16ee5c447981cc09ed8bb7ec7 (diff)
resource: Fix resources.Concat for transformed resources
Fixes #4936
Diffstat (limited to 'hugolib/resource_chain_test.go')
-rw-r--r--hugolib/resource_chain_test.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go
index b49e1ee72..d504b7d75 100644
--- a/hugolib/resource_chain_test.go
+++ b/hugolib/resource_chain_test.go
@@ -36,12 +36,15 @@ func TestResourceChain(t *testing.T) {
{{ $sass := resources.Get "sass/styles3.sass" | toCSS }}
{{ $scssCustomTarget := resources.Get "scss/styles2.scss" | toCSS (dict "targetPath" "styles/main.css") }}
{{ $scssCustomTargetString := resources.Get "scss/styles2.scss" | toCSS "styles/main.css" }}
-{{ $scssMin := resources.Get "scss/styles2.scss" | toCSS | minify }}
+{{ $scssMin := resources.Get "scss/styles2.scss" | toCSS | minify }}
+{{ $scssFromTempl := ".{{ .Kind }} { color: blue; }" | resources.FromString "kindofblue.templ" | resources.ExecuteAsTemplate "kindofblue.scss" . | toCSS (dict "targetPath" "styles/templ.css") | minify }}
+{{ $bundle1 := slice $scssFromTempl $scssMin | resources.Concat "styles/bundle1.css" }}
T1: Len Content: {{ len $scss.Content }}|RelPermalink: {{ $scss.RelPermalink }}|Permalink: {{ $scss.Permalink }}|MediaType: {{ $scss.MediaType.Type }}
T2: Content: {{ $scssMin.Content }}|RelPermalink: {{ $scssMin.RelPermalink }}
T3: Content: {{ len $scssCustomTarget.Content }}|RelPermalink: {{ $scssCustomTarget.RelPermalink }}|MediaType: {{ $scssCustomTarget.MediaType.Type }}
T4: Content: {{ len $scssCustomTargetString.Content }}|RelPermalink: {{ $scssCustomTargetString.RelPermalink }}|MediaType: {{ $scssCustomTargetString.MediaType.Type }}
T5: Content: {{ $sass.Content }}|T5 RelPermalink: {{ $sass.RelPermalink }}|
+T6: {{ $bundle1.Permalink }}
`)
}, func(b *sitesBuilder) {
b.AssertFileContent("public/index.html", `T1: Len Content: 24|RelPermalink: /scss/styles2.css|Permalink: http://example.com/scss/styles2.css|MediaType: text/css`)
@@ -50,6 +53,10 @@ T5: Content: {{ $sass.Content }}|T5 RelPermalink: {{ $sass.RelPermalink }}|
b.AssertFileContent("public/index.html", `T4: Content: 24|RelPermalink: /styles/main.css|MediaType: text/css`)
b.AssertFileContent("public/index.html", `T5: Content: .content-navigation {`)
b.AssertFileContent("public/index.html", `T5 RelPermalink: /sass/styles3.css|`)
+ b.AssertFileContent("public/index.html", `T6: http://example.com/styles/bundle1.css`)
+
+ b.AssertFileContent("public/styles/templ.min.css", `.home{color:blue}`)
+ b.AssertFileContent("public/styles/bundle1.css", `.home{color:blue}body{color:#333}`)
}},