Bundle & Minify CSS

I’d like to bundle static/css/style.css and static/fonts/fonts.css and minify as css/bundle.css using a partial called head.html. I can’t work out why this doesn’t work:

{{ $stylea := resources.Get "css/style.css" }}
{{ $styleb := resources.Get "fonts/fonts.css" }}
{{ $css := slice $styleb $stylea | resources.Concat "css/bundle.css" }}
<link href="css/bundle.css" rel="stylesheet">

The error generated is:

[...] execute of template failed: template: partials/head.html:16:52: executing "partials/head.html" at <resources.Concat>: error calling Concat: slice []interface {} not supported in concat

Can anybody see where I’ve gone wrong?

You need to either put these files inside /assets (or you could also configure it as a mount).

The error message you get here could probably be improved …

perfect. /assets it is. Thanks for the rapid reply!

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