Skip to content

Commit

Permalink
Integrate purgecss (#59)
Browse files Browse the repository at this point in the history
Integrated PurgeCSS to eradicate unused CSS.
Shrinks the size of CSS output considerably.
  • Loading branch information
Gary McLean Hall committed Apr 5, 2020
1 parent 97d72b0 commit a48d607
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 6 deletions.
90 changes: 90 additions & 0 deletions web/package-lock.json

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

3 changes: 2 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
"@fortawesome/fontawesome-svg-core": "^1.2.27",
"@fortawesome/free-solid-svg-icons": "^5.12.1",
"@fortawesome/vue-fontawesome": "^0.1.9",
"tailwindcss": "^1.2.0",
"@fullhuman/postcss-purgecss": "^2.1.0",
"axios": "^0.19.0",
"core-js": "^3.4.4",
"tailwindcss": "^1.2.0",
"vue": "^2.6.10",
"vue-headful": "^2.1.0",
"vue-moment": "^4.1.0",
Expand Down
28 changes: 23 additions & 5 deletions web/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
// postcss.config.js
const purgecss = require('@fullhuman/postcss-purgecss')({

// Specify the paths to all of the template files in your project
content: [
'./src/**/*.html',
'./src/**/*.vue',
'./src/**/*.js(x)',
// etc.
],

// Include any special characters you're using in this regular expression
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || []
})

module.exports = {
plugins: {
tailwindcss: './tailwind.config.js',
autoprefixer: {}
}
}
plugins: [
require('tailwindcss'),
require('autoprefixer'),
...process.env.NODE_ENV === 'production'
? [purgecss]
: []
]
}
4 changes: 4 additions & 0 deletions web/src/assets/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
@tailwind components;

@tailwind utilities;

* {
font-family: "Roboto", "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

0 comments on commit a48d607

Please sign in to comment.