Created
January 11, 2019 14:24
-
-
Save vkaelin/d0781e0e74bf87a11d404f369c522a0a to your computer and use it in GitHub Desktop.
Config Webpack Tailwind PurgeCSS
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 path = require('path') | |
const glob = require('glob') | |
const ExtractTextPlugin = require('extract-text-webpack-plugin') | |
const HtmlWebpackPlugin = require('html-webpack-plugin') | |
const PurgecssPlugin = require('purgecss-webpack-plugin') | |
const PATHS = { | |
src: path.join(__dirname, 'src') | |
} | |
module.exports = { | |
entry: './src/styles.css', | |
mode: process.env.NODE_ENV, | |
module: { | |
rules: [ | |
{ | |
test: /\.css$/, | |
use: ExtractTextPlugin.extract({ | |
fallback: 'style-loader', | |
use: [ | |
{ loader: 'css-loader', options: { importLoaders: 1 } }, | |
'postcss-loader', | |
], | |
}), | |
}, | |
], | |
}, | |
plugins: [ | |
new ExtractTextPlugin('styles.css', { | |
disable: process.env.NODE_ENV === 'development', | |
}), | |
new HtmlWebpackPlugin({ | |
filename: 'index.html', | |
template: 'src/index.html', | |
}), | |
new PurgecssPlugin({ | |
paths: glob.sync(`${PATHS.src}/*`) | |
}) | |
], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment