-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathslate.config.js
77 lines (73 loc) · 1.95 KB
/
slate.config.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Configuration file for all things Slate.
// For more information, visit https://github.com/Shopify/slate/wiki/Slate-Configuration
/* eslint-disable no-undef */
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const isDevelopment = process.env.NODE_ENV === "development";
const part = {
resolve: {
extensions: [".js", ".css", ".json"]
},
module: {
rules: [
{
test: /.js$/,
loader: "babel-loader",
exclude: /node_modules/
},
{
test: /.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/,
loader: "url-loader",
//include: path.join(__dirname, ''),
options: {
publicPath: "./",
limit: 10000
}
},
{
test: /\.pcss$/,
exclude: [ /node_modules/, /assets\/static/ ],
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
// you can specify a publicPath here
// by default it uses publicPath in webpackOptions.output
// publicPath: '../',
hmr: isDevelopment,
},
},
'style-loader',
'css-loader',
]
}
]
},
plugins: [
new MiniCssExtractPlugin()
]
};
const purgecss = require('@fullhuman/postcss-purgecss')({
// Specify the paths to all of the template files in your project
content: [
'./src/**/*.html',
'./src/**/*.liquid',
'./src/**/*.jsx'
],
// Include any special characters you're using in this regular expression
defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || []
});
module.exports = {
"webpack.extend": config => {
return part;
},
'webpack.postcss.plugins': (config, defaultValue) => [
require('tailwindcss'),
require('autoprefixer'),
require('cssnano')({
preset: 'default',
}),
...defaultValue,
...process.env.NODE_ENV === 'production' ? [purgecss] : []
]
};