Skip to content

Commit

Permalink
feat: use PostProcess
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris committed Apr 24, 2020
1 parent 537e166 commit 97bb014
Show file tree
Hide file tree
Showing 10 changed files with 399 additions and 4 deletions.
1 change: 1 addition & 0 deletions exampleSite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hugo_stats.json
2 changes: 2 additions & 0 deletions exampleSite/config/production/config.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Config for production
build:
writeStats: true
358 changes: 358 additions & 0 deletions exampleSite/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions exampleSite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "examplesite",
"version": "1.0.0",
"description": "",
"main": "postcss.config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"devDependencies": {
"@fullhuman/postcss-purgecss": "^2.1.2",
"autoprefixer": "^9.7.6"
}
}
15 changes: 15 additions & 0 deletions exampleSite/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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: [
// require('tailwindcss'),
require('autoprefixer'),
...(process.env.HUGO_ENVIRONMENT === 'production' ? [ purgecss ] : [])
]
};
Loading

0 comments on commit 97bb014

Please sign in to comment.