Tyding up css file

In my site, I have this to (1) concatenate my main.css code (generated locally by Codekit, already minified and stripped of any unused styles) with normalize.css and (2) apply cache-busting to the resulting file:

{{ $reset := resources.Get "css/normalize.css" }}
{{ $main := resources.Get "css/main.css" }}
{{ $css := slice $reset $main | resources.Concat "css/styles.css" }}

{{ $styles := resources.Get "css/styles.css" | fingerprint }}
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" />

Although this code works, I strongly suspect I could achieve the same result by being significantly less verbose, but lack the skills to do so. Does anyone have suggestions?

{{ $reset := resources.Get "css/normalize.css" }}
{{ $main := resources.Get "css/main.css" }}
{{ $styles := slice $reset $main | resources.Concat "css/styles.css" | fingerprint }}

<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" />
2 Likes

Thanks very much. Pretty obvious, I should have worked that out.

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