Hello everyone
I am fairly new to Hugo, but I do understand HTML and CSS pretty well.
I guess my issue is a setup issue. I followed this video in order to get TailwindCSS set up with Hugo.
In my head.html
file for my custom theme, I have the following:
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{ .Title }}</title>
<meta name="description" content="Mechanic360.io homepage" />
<meta name="author" content="J Khalaf" />
<meta property="og:title" content="Mechanic360.io homepage" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://mechanic360.io" />
<meta property="og:description" content="Mechanic360.io homepage" />
<meta property="og:image" content="image.png" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
{{ $styles := resources.Get "css/styles.scss" | toCSS | postCSS (dict "config"
"./assets/css/postcss.config.js") }} {{ if .Site.IsServer }}
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" />
{{ else }} {{ $styles := $styles | minify | fingerprint |
resources.PostProcess }}
<link
rel="stylesheet"
href="{{ $styles.Permalink }}"
integrity="{{ $styles.Data.Integrity }}"
/>
{{ end }}
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Source+Sans+Pro:wght@400;600;700&display=swap"
rel="stylesheet"
/>
</head>
There is some “magic” there that I don’t understand. Is the setup above “wrong”? How can I get the purging to work? Right now, the produced CSS when I run hugo -D
is 3.2Mb which is massive and I’m only using a few of Tailwind’s classes.
Any help would be greatly appreciated.