Skip to content

Commit

Permalink
#172 execute purgecss-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sklein94 committed Dec 9, 2021
1 parent dbb8301 commit b34bd1a
Show file tree
Hide file tree
Showing 4 changed files with 246 additions and 80 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@babel/preset-env": "^7.13.5",
"@babel/preset-react": "^7.12.13",
"@babel/preset-typescript": "^7.13.0",
"@fullhuman/postcss-purgecss": "^4.1.3",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.1",
"@types/react-router": "~4.4.5",
Expand Down Expand Up @@ -67,7 +68,7 @@
"jest-cli": "^26.6.3",
"jest-junit-reporter": "^1.1.0",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.8",
"postcss-loader": "4.0.3",
"prettier": "^2.2.1",
"raf": "3.4.0",
"style-loader": "0.19.0",
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
<version>2.5.0</version>
<configuration>
<node>
<version>10.23.0</version>
<version>12.13.0</version>
</node>
<pkgManager>
<type>YARN</type>
Expand Down
33 changes: 20 additions & 13 deletions src/main/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const paths = require('./paths');
const getClientEnvironment = require('./env');
const TerserPlugin = require('terser-webpack-plugin-legacy');

const purgecsss = require('@fullhuman/postcss-purgecss');

// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
const publicPath = paths.servedPath;
Expand Down Expand Up @@ -191,19 +193,24 @@ module.exports = {
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
postcssOptions: {
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
purgecsss({
content: ['./src/**/*.html', './src/**/*.tsx', './src/**/*.ts', '**/*.css'],
}),
],
},
},
},
],
Expand Down
Loading

0 comments on commit b34bd1a

Please sign in to comment.