Skip to content

Commit

Permalink
feat: use Hugo's built-in minification pipeline
Browse files Browse the repository at this point in the history
- Update head.html to use Hugo's resource.Minify for CSS and JS
- Add fingerprinting for cache busting
- Add integrity hashes for security
- Implement proper asset pipeline for custom CSS
  • Loading branch information
RileySeaburg committed Dec 3, 2024
1 parent 73b32d8 commit d78cf3d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions themes/digital.gov/layouts/partials/core/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,12 @@
{{- $customCSS := resources.Get (printf "dist/%s" .) -}}
{{- $customCSSMinified := $customCSS | resources.Minify -}}
<!-- CUSTOM CSS -->
<link rel="stylesheet" media="all" href="{{- $customCSSMinified.RelPermalink -}}" type="text/css" />
<link
rel="stylesheet"
media="all"
href="{{- $customCSSMinified.RelPermalink -}}"
type="text/css"
/>
{{- end -}}
{{- end -}}

Expand All @@ -243,7 +248,7 @@
{{/* USWDS Init JS */}}
{{- $uswdsInit := resources.Get "dist/js/uswds-init.min.js" -}}
{{- $uswdsInitMinified := $uswdsInit | resources.Minify | resources.Fingerprint -}}
<script
<script
src="{{ $uswdsInitMinified.RelPermalink }}"
integrity="{{ $uswdsInitMinified.Data.Integrity }}"
crossorigin="anonymous"
Expand Down

0 comments on commit d78cf3d

Please sign in to comment.