-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
80 lines (77 loc) · 2.18 KB
/
webpack.mix.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
78
79
80
const mix = require( 'laravel-mix' );
require( 'laravel-mix-svg-sprite' );
require( 'laravel-mix-eslint' );
require( 'laravel-mix-eslint-config' );
// TODO: extract() shoud be fixed. Polyfills, aliases. Different setup for dev and prod builds
// eslint-disable-next-line no-undef
Config.imgLoaderOptions.svgo = {
plugins: [
{ removeTitle: true },
{ removeAttrs: { attrs: [ 'path:fill', 'path:class' ] } },
],
};
// eslint-disable-next-line no-undef
Config.svgSprite = {
/*
* @see https://github.com/kisenka/svg-sprite-loader#configuration
*/
loaderOptions: {
symbolId: 'icon-[name]',
extract: true,
spriteFilename: 'icons.svg',
spriteAttrs: { style: 'display: none;' },
},
/*
* @see https://github.com/kisenka/svg-sprite-loader#configuration
*/
pluginOptions: {
plainSprite: true,
spriteAttrs: { style: 'display: none;' },
},
};
mix.webpackConfig( {
externals: { jquery: 'jQuery' },
} )
.js( 'assets/scripts/theme-tredu.js', 'theme_tredu.js' )
.autoload( {
jquery: [ '$', 'window.jQuery' ],
} )
.eslint( {
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
configFile: '.eslintrc.json',
fix: true,
cache: false,
failOnWarning: false,
failOnError: true,
},
} )
//.extract() // this breaks all JS without errors
.sass( 'assets/styles/theme-tredu.scss', 'theme_tredu.css' )
.options( {
processCssUrls: false,
postCss: [
require( 'css-mqpacker' )( {
sort: true,
} ),
require( 'cssnano' )( {
preset: [
'default',
{
discardComments: {
removeAll: true,
},
},
],
} ),
],
} )
.svgSprite(
'assets/icons', // The directory containing your SVG files
'icons.svg' // The output path for the sprite
)
.version()
.setPublicPath( 'assets/dist' );