-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.mix.js
51 lines (41 loc) · 1.51 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
const mix = require('laravel-mix');
require('laravel-mix-purgecss');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Sage application. By default, we are compiling the Sass file
| for your application, as well as bundling up your JS files.
|
*/
mix.setPublicPath('./dist')
.browserSync('commons.platform.coop.test');
mix.sass('resources/assets/styles/main.scss', 'styles', {
sassOptions: {
includePaths: [path.join(__dirname, 'node_modules')],
},
});
mix.js('resources/assets/scripts/main.js', 'scripts')
.js('resources/assets/scripts/customizer.js', 'scripts')
.extract();
mix.copy('resources/assets/images', 'dist/images')
.copy('resources/assets/fonts', 'dist/fonts')
.copy('node_modules/@platform-coop-toolkit/pinecone/src/assets/images', 'dist/images')
.copy('node_modules/@platform-coop-toolkit/pinecone/src/assets/fonts', 'dist/fonts');
mix.options({
processCssUrls: false,
});
mix.sourceMaps(false, 'source-map')
.version();
mix.then(() => {
const manifest = File.find('./dist/mix-manifest.json');
const json = JSON.parse(manifest.read());
Object.keys(json).forEach(key => {
const hashed = json[key];
delete json[key];
json[key.replace(/^\/+/g, '')] = hashed.replace(/^\/+/g, '');
});
manifest.write(JSON.stringify(json, null, 2));
});