forked from ForgeRock/forgerock-javascript-sdk-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.scss.js
66 lines (62 loc) · 1.48 KB
/
webpack.config.scss.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
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 = [
'cpy ./bundles/fr-ui.css ./samples/_static/css',
'cpy ./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',
},
},
{
loader: 'sass-loader',
options: {
sassOptions: {
includePaths: ['node_modules/@forgerock/ui-design/src/scss'],
},
},
},
],
},
],
},
optimization: {
minimize: true,
},
output: {
path: path.resolve('./bundles'),
},
plugins,
watch: isDev,
};
};