-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
31 lines (26 loc) · 916 Bytes
/
index.php
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
<?php
function mix($path, $manifestDirectory = '')
{
static $manifest;
if ($manifestDirectory && strpos($manifestDirectory, '/') !== 0) {
$manifestDirectory = "/{$manifestDirectory}";
}
if (! $manifest) {
if (! file_exists($manifestPath = $manifestDirectory.'/mix-manifest.json')) {
throw new Exception('The Mix manifest does not exist.');
}
$manifest = json_decode(file_get_contents($manifestPath), true);
}
if (strpos($path, '/') !== 0) {
$path = "/{$path}";
}
if (! array_key_exists($path, $manifest)) {
throw new Exception(
"Unable to locate Mix file: {$path}. Please check your ".
'webpack.mix.js output paths and try again.'
);
}
return file_exists($manifestDirectory.'/hot')
? "http://localhost:8080{$manifest[$path]}"
: $manifest[$path];
}