-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
132 lines (115 loc) · 3.24 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
const mix = require('laravel-mix');
const path = require('path');
const rimraf = require("rimraf");
require('laravel-mix-banner');
require('laravel-mix-php-manifest');
require('laravel-mix-polyfill');
require('laravel-mix-svg-sprite');
require('laravel-mix-tailwind');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel applications. By default, we are compiling the CSS
| file for the application as well as bundling up all the JS files.
|
*/
const date = new Date();
// Function to convert
// single digit input
// to two digits
const formatData = (input) => {
if (input > 9) {
return input;
} else return `0${input}`;
};
// Function to convert
// 24 Hour to 12 Hour clock
const formatHour = (input) => {
if (input > 12) {
return input - 12;
}
return input;
};
// Data about date
const format = {
dd: formatData(date.getDate()),
mm: formatData(date.getMonth() + 1),
yyyy: date.getFullYear(),
HH: formatData(date.getHours()),
hh: formatData(formatHour(date.getHours())),
MM: formatData(date.getMinutes()),
SS: formatData(date.getSeconds()),
};
const format24Hour = ({dd, mm, yyyy, HH, MM, SS}) => {
return (`${mm}/${dd}/${yyyy} ${HH}:${MM}:${SS}`);
};
if (require('fs').existsSync('.airdrop_skip')) {
console.log('Assets already exist. Skipping compilation.');
process.exit(0);
}
mix
.banner({
banner: (function () {
return [
'/**',
' * @project Datacenter Automation Suite',
' * @author FiberHop LLC',
' * @build ' + format24Hour(format),
' * @release ALPHA',
' *',
' */',
'',
].join('\n');
})(),
raw: true,
})
.ts('resources/js/app.ts', 'public/js')
.react()
.extract(["react"])
.extract(['tailwindcss',], 'js/tailwindcss-resources')
.ts('resources/js/customer.ts', 'public/js')
.ts('resources/js/internal.ts', 'public/js')
.ts('resources/js/vendor-role.ts', 'public/js')
.ts('resources/js/whitegloves.ts', 'public/js')
.sourceMaps()
.sass('resources/sass/customer.scss', 'public/css')
.sass('resources/sass/internal.scss', 'public/css')
.sass('resources/sass/vendor-role.scss', 'public/css')
.sass('resources/sass/whitegloves.scss', 'public/css')
.css('resources/css/app.css', 'public/css')
.tailwind()
.phpManifest()
.polyfill({
enabled: true,
useBuiltIns: "usage",
targets: "firefox 50, IE 11"
})
// .svgSprite(
// 'src/icons', // The directory containing your SVG files
// 'output/sprite.svg', // The output path for the sprite
// )
.webpackConfig({
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/
}
]
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'resources/js/'),
'@Components': path.resolve(__dirname, 'resources/js/Components'),
'~': path.resolve(__dirname, 'resources/sass/'),
},
extensions: ["*", ".js", ".jsx", ".ts", ".tsx"]
}
});
if (mix.inProduction()) {
mix.version();
}