Skip to content

Commit 47b9bf6

Browse files
committed
adding scss-compilation (broken)
1 parent 56e8d67 commit 47b9bf6

File tree

2 files changed

+81
-2
lines changed

2 files changed

+81
-2
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,19 @@
3535
"bootstrap-fileinput": "^4.4.9",
3636
"classnames": "^2.2.6",
3737
"cross-env": "^5.2.0",
38+
"css-loader": "^1.0.0",
39+
"file-loader": "^1.1.11",
3840
"jquery": "^3.3.1",
3941
"locks": "^0.2.2",
42+
"mini-css-extract-plugin": "^0.4.1",
4043
"node-sass": "^4.9.3",
4144
"prop-types": "latest",
4245
"react": "^16.4.2",
4346
"react-dom": "^16.4.2",
4447
"react-native-listener": "^1.0.2",
4548
"react-router": "^4.3.1",
4649
"react-router-dom": "^4.3.1",
50+
"sass-loader": "^7.1.0",
4751
"semver": "^5.5.0",
4852
"sweetalert2": "^7.26.11",
4953
"sweetalert2-react-content": "^1.0.1",

webpack.config.js

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
const path = require('path');
2+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
23

34
module.exports = {
4-
entry: './ui/index.js',
5+
entry: {
6+
// js: './ui/index.js',
7+
sass: './ui/index.scss'
8+
},
59
output: {
610
filename: 'bundle.js',
711
path: path.resolve(__dirname, 'app')
@@ -20,10 +24,81 @@ module.exports = {
2024
use: {
2125
loader: 'babel-loader'
2226
}
27+
},
28+
{
29+
test: /\.scss$/,
30+
use: [
31+
MiniCssExtractPlugin.loader,
32+
"css-loader",
33+
"sass-loader"
34+
]
35+
},
36+
{
37+
test: /(\.(png|jpe?g|gif)$|^((?!font).)*\.svg$)/,
38+
loaders: [
39+
{
40+
loader: "file-loader",
41+
options: {
42+
name: path => {
43+
console.log("es ist ein BILD!");
44+
console.log(path);
45+
if(!/node_modules|bower_components/.test(path)) {
46+
return "app/images/[name].[ext]?[hash]";
47+
}
48+
49+
return (
50+
"app/images/vendor/" +
51+
path.replace(/\\/g, "/")
52+
.replace(
53+
/((.*(node_modules|bower_components))|images|image|img|assets)\//g,
54+
''
55+
) +
56+
'?[hash]'
57+
);
58+
},
59+
publicPath: 'app/'
60+
}
61+
}
62+
]
63+
},
64+
{
65+
test: /(\.(woff2?|ttf|eot|otf)$|font.*\.svg$)/,
66+
loaders: [
67+
{
68+
loader: "file-loader",
69+
options: {
70+
name: path => {
71+
console.log("testausgabe");
72+
console.log(path);
73+
if (!/node_modules|bower_components/.test(path)) {
74+
return 'app/fonts/[name].[ext]?[hash]';
75+
}
76+
77+
return (
78+
'app/fonts' +
79+
'/vendor/' +
80+
path
81+
.replace(/\\/g, '/')
82+
.replace(
83+
/((.*(node_modules|bower_components))|fonts|font|assets)\//g,
84+
''
85+
) +
86+
'?[hash]'
87+
);
88+
},
89+
publicPath: 'app/'
90+
}
91+
}
92+
]
2393
}
2494
]
2595
},
2696
performance: {
2797
hints: false
28-
}
98+
},
99+
plugins: [
100+
new MiniCssExtractPlugin({
101+
filename: "bundle.css"
102+
})
103+
]
29104
}

0 commit comments

Comments
 (0)