forked from stefanzweifel/dropshare-tailwind-landingpage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.mix.js
52 lines (48 loc) · 1.34 KB
/
webpack.mix.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const { mix } = require('laravel-mix');
const tailwindcss = require('tailwindcss');
const purgeCss = require('purgecss-webpack-plugin');
const glob = require('glob-all');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const StyleExtHtmlWebpackPlugin = require('style-ext-html-webpack-plugin');
mix.disableNotifications();
/**
* Build CSS with Tailwind
*/
mix.postCss('src/main.css', 'dist/css', [
tailwindcss('./tailwind.js'),
]);
/**
* Additional Webpack Configuration
*
* - Remove not used CSS with purgecss
* - Inline CSS with HtmlWebpackPlugin
*/
mix.webpackConfig({
plugins: [
new purgeCss({
paths: glob.sync(
[
path.join(__dirname, './dist/**/*.html'),
]
),
whitelist: ['img', 'video'],
extractors: [
{
extractor: class {
static extract(content) {
return content.match(/[A-z0-9-:\/]+/g)
}
},
extensions: ['html'],
}
]
}),
new HtmlWebpackPlugin({
template: 'dist/template-index.html',
filename: 'dist/index.html',
}),
new StyleExtHtmlWebpackPlugin({
minify: true
}),
]
})