Skip to content

Instantly share code, notes, and snippets.

@culttm
Created October 4, 2019 09:49
Show Gist options
  • Save culttm/abb7994d2a0d522c1c685b9e7d4f9b2e to your computer and use it in GitHub Desktop.
Save culttm/abb7994d2a0d522c1c685b9e7d4f9b2e to your computer and use it in GitHub Desktop.
Webpack + tailwindcss
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