Add purgecss to css processing workflow
This commit is contained in:
parent
60bed163e3
commit
5da06e3a87
3 changed files with 17 additions and 1 deletions
|
@ -4,6 +4,9 @@ title = "MillironX"
|
||||||
paginate = 5
|
paginate = 5
|
||||||
theme = "ananke"
|
theme = "ananke"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
writeStats = true
|
||||||
|
|
||||||
[Params]
|
[Params]
|
||||||
cardImage = "saddles"
|
cardImage = "saddles"
|
||||||
motto = ""
|
motto = ""
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
{{ $twbscss := resources.Get "node/node_modules/bootstrap/scss/bootstrap.scss" | resources.ToCSS }}
|
{{ $twbscss := resources.Get "node/node_modules/bootstrap/scss/bootstrap.scss" | resources.ToCSS }}
|
||||||
{{ $mycss := resources.Get "styles/main.css" }}
|
{{ $mycss := resources.Get "styles/main.css" }}
|
||||||
{{ $allcss := slice $twbscss $mycss | resources.Concat "css/bundle.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">
|
<link href="{{ $allcsspure.Permalink }}" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
13
postcss.config.js
Normal file
13
postcss.config.js
Normal file
|
@ -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…
Reference in a new issue