Add purgecss to css processing workflow

pull/5/head
parent 60bed163e3
commit 5da06e3a87
Signed by: millironx
GPG Key ID: 139C07724802BC5D

@ -4,6 +4,9 @@ title = "MillironX"
paginate = 5
theme = "ananke"
[build]
writeStats = true
[Params]
cardImage = "saddles"
motto = ""

@ -10,7 +10,7 @@
{{ $twbscss := resources.Get "node/node_modules/bootstrap/scss/bootstrap.scss" | resources.ToCSS }}
{{ $mycss := resources.Get "styles/main.css" }}
{{ $allcss := slice $twbscss $mycss | resources.Concat "css/bundle.css" }}
{{ $allcsspure := $allcss | resources.PostCSS | minify | fingerprint | resources.PostProcess }}
{{ $allcsspure := $allcss | resources.PostCSS (dict "nomap" true) | minify | fingerprint | resources.PostProcess }}
<link href="{{ $allcsspure.Permalink }}" rel="stylesheet">
</head>

@ -0,0 +1,13 @@
const purgecss = require('@fullhuman/postcss-purgecss')({
content: ['./hugo_stats.json'],
defaultExtractor: (content) => {
let els = JSON.parse(content).htmlElements;
return els.tags.concat(els.classes, els.ids);
}
});
module.exports = {
plugins: [
purgecss
]
}
Loading…
Cancel
Save