Skip to content

Commit

Permalink
Rework tailwind config, remove purgeCSS
Browse files Browse the repository at this point in the history
  • Loading branch information
chringel21 committed Mar 22, 2022
1 parent c4c822c commit f7192bb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 32 deletions.
36 changes: 11 additions & 25 deletions assets/css/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
const themeDir = __dirname + '/../../';

const purgecss = require('@fullhuman/postcss-purgecss')({
// see https://gohugo.io/hugo-pipes/postprocess/#css-purging-with-postcss
content: [
'./hugo_stats.json',
themeDir + '/hugo_stats.json',
'exampleSite/hugo_stats.json',
],
defaultExtractor: (content) => {
let els = JSON.parse(content).htmlElements;
return els.tags.concat(els.classes, els.ids);
}
})

module.exports = {
plugins: [
require('postcss-import')({
path: [themeDir]
}),
require('tailwindcss')(themeDir + 'assets/css/tailwind.config.js'),
require('autoprefixer')({
path: [themeDir]
}),
...(process.env.HUGO_ENVIRONMENT === 'production' ? [purgecss] : [])
]
}
module.exports = {
plugins: [
require("postcss-import")({
path: [themeDir],
}),
require("tailwindcss")(themeDir + "assets/css/tailwind.config.js"),
require("autoprefixer")({
path: [themeDir],
}),
],
};
19 changes: 13 additions & 6 deletions assets/css/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
const colors = require('tailwindcss/colors')
const { borderColor, fontWeight, fontFamily } = require('tailwindcss/defaultTheme')
const themeDir = __dirname + "/../../";
const colors = require("tailwindcss/colors");
const {
borderColor,
fontWeight,
fontFamily,
} = require("tailwindcss/defaultTheme");

module.exports = {
content: [
"./themes/**/layouts/**/*.html",
"./themes/**/assets/js/**/*.js",
"./layouts/**/*.html",
"./assets/js/**/*.js",
themeDir + "layouts/**/*.html",
themeDir + "assets/js/**/*.js",
"layouts/**/*.html",
"assets/js/**/*.js",
"exampleSite/layouts/**/*.html",
"exampleSite/assets/js/**/*.js",
],
theme: {
extend: {
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<footer class="bottom-0 w-full bg-gray-200 dark:bg-black p-4 text-xs text-center text-gray-400">
<p>made with <a href="https://gohugo.io" class="underline hover:text-accent-400">Hugo</a> and <a href="https://tailwindcss.com" class="underline hover:text-accent-400">TailwindCSS</a></p>
<p>&copy; {{ .Site.Params.footerCopyrightText }}</p>
<div class="hidden link copy-code-button link-owner"></div>
<div class="hidden"></div>
</footer>
{{ if or (findRE "<pre" .Content 1) (eq .Section "post" ) }}
{{ $functionsScriptPath := "js/functions.js" }}
Expand Down

0 comments on commit f7192bb

Please sign in to comment.