mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
@@ -290,6 +290,7 @@ func TestOptionVars(t *testing.T) {
|
|||||||
body {
|
body {
|
||||||
body {
|
body {
|
||||||
background: url(vars.$image) no-repeat center/cover;
|
background: url(vars.$image) no-repeat center/cover;
|
||||||
|
font-family: vars.$font;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +304,8 @@ b {
|
|||||||
}
|
}
|
||||||
-- layouts/index.html --
|
-- layouts/index.html --
|
||||||
{{ $image := "images/hero.jpg" }}
|
{{ $image := "images/hero.jpg" }}
|
||||||
{{ $vars := dict "$color1" "blue" "$color2" "green" "font_size" "24px" "image" $image }}
|
{{ $font := "Hugo's New Roman" }}
|
||||||
|
{{ $vars := dict "$color1" "blue" "$color2" "green" "font_size" "24px" "image" $image "font" $font }}
|
||||||
{{ $cssOpts := (dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" $vars ) }}
|
{{ $cssOpts := (dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" $vars ) }}
|
||||||
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }}
|
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }}
|
||||||
T1: {{ $r.Content }}
|
T1: {{ $r.Content }}
|
||||||
@@ -316,7 +318,7 @@ T1: {{ $r.Content }}
|
|||||||
NeedsOsFS: true,
|
NeedsOsFS: true,
|
||||||
}).Build()
|
}).Build()
|
||||||
|
|
||||||
b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover}p{color:blue;font-size:24px}b{color:green}`)
|
b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover;font-family:Hugo's New Roman}p{color:blue;font-size:24px}b{color:green}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOptionVarsParams(t *testing.T) {
|
func TestOptionVarsParams(t *testing.T) {
|
||||||
|
@@ -263,6 +263,7 @@ func TestOptionVars(t *testing.T) {
|
|||||||
body {
|
body {
|
||||||
body {
|
body {
|
||||||
background: url($image) no-repeat center/cover;
|
background: url($image) no-repeat center/cover;
|
||||||
|
font-family: $font;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +277,8 @@ b {
|
|||||||
}
|
}
|
||||||
-- layouts/index.html --
|
-- layouts/index.html --
|
||||||
{{ $image := "images/hero.jpg" }}
|
{{ $image := "images/hero.jpg" }}
|
||||||
{{ $vars := dict "$color1" "blue" "$color2" "green" "font_size" "24px" "image" $image }}
|
{{ $font := "Hugo's New Roman" }}
|
||||||
|
{{ $vars := dict "$color1" "blue" "$color2" "green" "font_size" "24px" "image" $image "font" $font }}
|
||||||
{{ $cssOpts := (dict "transpiler" "libsass" "outputStyle" "compressed" "vars" $vars ) }}
|
{{ $cssOpts := (dict "transpiler" "libsass" "outputStyle" "compressed" "vars" $vars ) }}
|
||||||
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }}
|
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }}
|
||||||
T1: {{ $r.Content }}
|
T1: {{ $r.Content }}
|
||||||
@@ -289,5 +291,5 @@ T1: {{ $r.Content }}
|
|||||||
NeedsOsFS: true,
|
NeedsOsFS: true,
|
||||||
}).Build()
|
}).Build()
|
||||||
|
|
||||||
b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover}p{color:blue;font-size:var 24px}b{color:green}`)
|
b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover;font-family:Hugo's New Roman}p{color:blue;font-size:var 24px}b{color:green}`)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user