This repository was archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathwebpack.config.scss.js
More file actions
86 lines (82 loc) · 2.08 KB
/
webpack.config.scss.js
File metadata and controls
86 lines (82 loc) · 2.08 KB
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
78
79
80
81
82
83
84
85
86
const { exec } = require('child_process');
const path = require('path');
module.exports = (env) => {
const isDev = env.DEV === 'yes';
const plugins = [
{
apply: (compiler) => {
compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
const cmds = [
'copyfiles -u 1 "./bundles/fr-ui.css" ./samples/_static/css/',
'copyfiles -u 1 "./bundles/fr-ui.css" ./tests/e2e/app/_static/css',
];
for (var cmd of cmds) {
exec(cmd, (err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
if (stdout) process.stdout.write(stdout);
if (stderr) process.stderr.write(stderr);
});
}
});
},
},
];
return {
entry: './src/css/sdk.scss',
mode: 'production',
module: {
rules: [
{
test: /\.scss$/,
use: [
{
loader: 'file-loader',
options: {
name: 'fr-ui.css',
},
},
{
// Run postcss actions
loader: 'postcss-loader',
options: {
// `postcssOptions` is needed for postcss 8.x;
// if you use postcss 7.x skip the key
postcssOptions: {
// postcss plugins, can be exported to postcss.config.js
plugins: [
[
'autoprefixer',
{
// Options
},
],
],
},
},
},
{
loader: 'sass-loader',
options: {
sassOptions: {
includePaths: [],
},
},
},
],
},
],
},
optimization: {
minimize: true,
},
output: {
filename: 'main.js',
path: path.resolve('./bundles'),
},
plugins,
watch: isDev,
};
};