Minify range of custom css plugins


I am new to Hugo and scripting. I have my website up and running fine. What I am trying to do is opimize the page load time and hence trying to minify the custom css stylesheet plugins.

Head Partial: Current Situation (no issues with working):

  {{ "<!-- Main Stylesheet -->" | safeHTML }}
  {{ $styles := resources.Get "css/style.css" | minify }}
  <link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">

  {{ "<!-- plugins -->" | safeHTML }}
  {{ range .Site.Params.plugins.css }}
  <link rel="stylesheet" href="{{ .link | absURL }} ">
  {{ end }}

The main stylesheet is minified while the custom css plugins are not. I would like some help to minify the plugins as well

Tried this {{ range .Site.Params.plugins.css | minify }}, but it does not work.

Please guide.


The minify pipe is for resources:

I’m guessing your .Site.Params.plugins.css are a list of css urls, and not resources.

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