Skip to content

Instantly share code, notes, and snippets.

@apoorvmote
Last active March 1, 2021 11:16
Show Gist options
  • Save apoorvmote/552387dd95883f5c3fabc06f253ba7c0 to your computer and use it in GitHub Desktop.
Save apoorvmote/552387dd95883f5c3fabc06f253ba7c0 to your computer and use it in GitHub Desktop.
{
"printWidth": 120,
"proseWrap": "always",
"semi": false,
"overrides": [
{
"files": ["*.html"],
"options": {
"parser": "go-template"
}
}
]
}
---
title: Hugo with TailwindCSS
---
<p>Welcome to my blog</p>
<p>You can publicly access <a href="https://github.com/apoorvmote/hugo-tailwindcss">source code</a> of this blog on github.</p>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ .Title }}</title>
<style>
{{ $options := dict "inlineImports" true }}
{{ $styles := resources.Get "css/styles.css" | resources.PostCSS $options }}
{{ if hugo.IsProduction }}
{{ $styles = $styles | minify | resources.PostProcess }}
{{ end }}
{{ $styles.Content | safeCSS }}
</style>
</head>
<body>
{{ block "main" . }}{{ end }}
</body>
</html>
{{ define "main" }}
<article class="mx-auto mt-6 prose prose-indigo lg:prose-lg xl:prose-xl 2xl:prose-2xl">
<h1 class="text-4xl">{{ .Title }}</h1>
{{ .Content }}
</article>
{{ end }}
module.exports = {
purge: {
content: ["./hugo_stats.json", "./layouts/**/*.html"],
extractors: [
{
extractor: (content) => {
let els = JSON.parse(content).htmlElements
return els.tags.concat(els.classes, els.ids)
}
}
],
mode: 'all',
enabled: process.env.HUGO_ENVIRONMENT === "production",
options: {
keyframes: true,
}
},
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [require("@tailwindcss/typography")],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment