How to use a variable with Slice and resources.Get

Hi All,

How can I use a variable for resource.Get inside of a slice?

I’ve tried with printf etc but just can’t quite crack the syntax.

In the below example - how do I get my variable into “variable_here”

<!--Main page stylesheet-->
{{- $CSS := slice
(resources.Get "css/service-areas/buttons-section.css")
(resources.Get "variable_here")
(resources.Get "css/modules/discount-coupons.css")
| resources.Concat "assets/css/main-services.css" | postCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $CSS.RelPermalink | relURL }}">

Thanks guys

just write the variable:

{{ $variable := "variable_value" }}

{{- $CSS := slice
(resources.Get "css/service-areas/buttons-section.css")
(resources.Get $variable)
(resources.Get "css/modules/discount-coupons.css")
| resources.Concat "assets/css/main-services.css" | postCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $CSS.RelPermalink | relURL }}">
1 Like

Yes I tried that before posting, doesn’t seem to work…

Okay all good, it was another bug, thanks.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.