forked from ideativedigital/stock-pictures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
56 lines (49 loc) · 1.7 KB
/
webpack.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
const path = require('path');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
// Hard code this to production but can be adapted to accept args to change env.
const mode = 'production';
module.exports = {
mode,
output: {
// Where the CSS is saved to
path: path.resolve(__dirname, 'Resources/Public/Css'),
publicPath: "/typo3conf/ext/id_stock_pictures/Resources/Public/Css"
},
resolve: {
extensions: ['.css', '.scss'],
alias: {
// Provides ability to include node_modules with ~
'~': path.resolve(process.cwd(), 'src'),
},
},
entry: {
// Will create "styles.css" in "css" dir.
"styles": './Resources/Private/Scss/backend.scss',
},
module: {
rules: [
{
test: /\.scss$/,
use: [
// Extract and save the final CSS.
MiniCssExtractPlugin.loader,
// Load the CSS, set url = false to prevent following urls to fonts and images.
{ loader: "css-loader", options: { url: false, importLoaders: 1 } },
// Add browser prefixes and minify CSS.
{ loader: 'postcss-loader', options: { plugins: [autoprefixer(), cssnano()] }},
// Load the SCSS/SASS
{ loader: 'sass-loader' },
],
},
],
},
plugins: [
// Define the filename pattern for CSS.
new MiniCssExtractPlugin({
filename: 'backend.css',
chunkFilename: '[id].css',
})
]
}