Hi,
I am actually building a theme with Hugo. The theme is going to use Bootstrap from CDN, so I’ve just hardcoded bootstrap references. However, I want to apply some small customisation to colour palette.
With themestr.app I’ve generarated an additional CSS to change bootstrap.
I’ve downloaded the css file and put into the asset/css
directory. Then, I’ve added the following code:
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
{{ $baseCSS := resources.Get "css/custom.css" | resources.ExecuteAsTemplate "css/custom.css" . | minify | fingerprint }}
{{ $extraCSS := .Scratch.Get "css" | uniq }}
{{ $allCSS := $baseCSS | slice | append $extraCSS }}
{{ range $allCSS }}
<link rel="stylesheet" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}">
{{ end }}
However, hugo raise an error:
theme/layouts/partials/head.html:7:61": execute of template failed: template: partials/head.html:7:61: executing "partials/head.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type <nil> not supported in Resource transformations
My custom.css
is available at this pen https://codepen.io/lunaticmuch/pen/QegZpG
What’s wrong? If I make an HTML page attaching bootstrap and this css it works.
thanks in advance
LM