Skip to content

Commit

Permalink
purgecss
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikzogg committed Apr 18, 2020
1 parent c963fc1 commit 9d056f5
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
15 changes: 15 additions & 0 deletions config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
module.exports = {
webpack: function (config, env) {
const purgecss = require('@fullhuman/postcss-purgecss')({

// Specify the paths to all of the template files in your project
content: [
'./src/**/*.html',
'./src/**/*.jsx',
'./src/**/*.tsx',
],

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

config.module.rules.push({
test: /\.css$/,
Expand All @@ -12,6 +24,9 @@ module.exports = {
require('tailwindcss'),
require('postcss-nested'),
require('autoprefixer'),
...process.env.NODE_ENV === 'production'
? [purgecss]
: []
],
},
},
Expand Down
30 changes: 30 additions & 0 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,8 @@
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jest-environment-jsdom-sixteen"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^2.1.2"
}
}
11 changes: 9 additions & 2 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
@tailwind base;
@tailwind components;
/* purgecss start ignore */
@tailwind base;
@tailwind components;
/* purgecss end ignore */

@tailwind utilities;

/* purgecss start ignore */

html,
body,
#root {
Expand Down Expand Up @@ -321,3 +326,5 @@ dd {
@apply w-4/5;
}
}

/* purgecss end ignore */

0 comments on commit 9d056f5

Please sign in to comment.