forked from saproto/saproto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.mix.js
48 lines (43 loc) · 1.29 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
const mix = require('laravel-mix')
const glob = require('glob')
const paths = {
styles: {
src: 'resources/assets/sass/',
dst: 'public/css/'
},
scripts: {
src: 'resources/assets/js/',
dst: 'public/js/',
chunks: {
bootstrap: ['bootstrap', 'popper.js'],
interface: ['easymde', 'swiper', 'signature_pad', 'codethereal-iconpicker']
}
},
}
mix .webpackConfig({ devtool: "inline-source-map" })
.options({
postCss: [
require('postcss-discard-comments')({
removeAll: true
})
],
uglify: {
comments: false
}
})
//Compile all theme SCSS
glob.sync('!(*.example).scss', {cwd: paths.styles.src}).forEach(fileName => {
let src = paths.styles.src+fileName
let dest = paths.styles.dst+'application-'+fileName.replace('scss', 'css')
mix .sass(src, dest, {
sassOptions: { quietDeps: true } // Mute deprecation warnings because of Bootstrap 4
})
})
// Compile all javascript
mix.js(paths.scripts.src+'application.js', paths.scripts.dst)
Object.entries(paths.scripts.chunks).forEach(([name, packages]) => {
mix.extract(packages, paths.scripts.dst+name+'~vendor.js')
})
mix.extract()
// Enable versioning
mix.version()