Fingerprint and other stylesheet-related HTML attributes

{{ $stylesA := resources.Get "css/styles-a.css" | postCSS (dict "config" "./assets/css/postcss.config.js") }} {{
$stylesB := resources.Get "css/styles-b.css" | postCSS (dict "config" "./assets/css/postcss.config.js") }} {{ $bundle :=
slice $stylesA $stylesB | resources.Concat "css/bundle.css" | minify | fingerprint | resources.PostProcess }}

The above snippet retrieves styles-a.css and styles-b.css from the assets/css directory. Each stylesheet is processed with postCSS following the config set in postcss.config.js, then sliced (merged) together to form bundle.css.

The resulting bundled stylesheet is then piped through minify (removes unnecessary characters including whitespace) and fingerprint (ensures the resources have not been tampered with, and indirectly tells the browser to not cache old versions of the stylesheet).

resources.PostProcess delays the transformation to after the build.

Related