-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.mix.js
55 lines (46 loc) · 1.81 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
const fs = require('fs-extra');
const mix = require('laravel-mix');
fs.removeSync('public/assets');
mix.setPublicPath('public/assets');
mix.sourceMaps(true, 'source-map');
// Compile custom style.
mix.sass('resources/css/style.scss', 'public/assets/css').options({
processCssUrls: false
});
// Compile JavaScript files.
const javaScriptFiles = [
'add.js',
'table.js',
'map.js'
];
javaScriptFiles.forEach(file => mix.copy('resources/js/' + file, 'public/assets/js'));
// Copy required CSS, JavaScript and images from libraries.
const cssFilesForLeaflet = [
'node_modules/leaflet/dist/leaflet.css',
'node_modules/leaflet.markercluster/dist/MarkerCluster.css',
'node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css'
];
mix.styles(cssFilesForLeaflet, 'public/assets/lib/leaflet-bundle.css');
const javaScriptLibraries = [
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/highcharts/highcharts.js',
'node_modules/leaflet/dist/leaflet.js',
'node_modules/leaflet.markercluster/dist/leaflet.markercluster.js',
'node_modules/tablesort/dist/tablesort.min.js'
];
javaScriptLibraries.forEach(file => mix.copy(file, 'public/assets/lib'));
mix.copy('node_modules/leaflet/dist/images/layers*.png', 'public/assets/lib/images');
mix.copy('node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands*', 'public/assets/webfonts');
mix.copy('node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid*', 'public/assets/webfonts');
// Setup hash-based file names for the production environment.
if (mix.inProduction()) {
mix.version();
mix.then(() => {
const convertToFileHash = require('laravel-mix-make-file-hash');
convertToFileHash({
publicPath: 'public/assets/',
manifestFilePath: 'public/assets/mix-manifest.json',
blacklist: ['webfonts', 'lib/images/**']
});
});
}