Created
October 4, 2019 09:49
-
-
Save culttm/abb7994d2a0d522c1c685b9e7d4f9b2e to your computer and use it in GitHub Desktop.
Webpack + tailwindcss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const purgecss = require('@fullhuman/postcss-purgecss')({ | |
// Specify the paths to all of the template files in your project | |
content: [ | |
'./src/**/*.html', | |
'./src/**/*.jsx', | |
// etc. | |
], | |
// Include any special characters you're using in this regular expression | |
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [] | |
}); | |
module.exports = { | |
module : { | |
rules: [ | |
{ | |
test : /\.scss$/, | |
loader : 'postcss-loader', | |
options: { | |
ident : 'postcss', | |
syntax: 'postcss-scss', | |
plugins: () => [ | |
require('postcss-import'), | |
require('tailwindcss'), | |
require('autoprefixer'), | |
...process.env.NODE_ENV === 'production' | |
? [purgecss] | |
: [] | |
] | |
} | |
} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment