-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmix.php
More file actions
34 lines (23 loc) · 805 Bytes
/
mix.php
File metadata and controls
34 lines (23 loc) · 805 Bytes
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
<?php
require('vendor/autoload.php');
$dotenv = Dotenv\Dotenv::create(__DIR__);
$dotenv->load();
function mix($path) {
$manifests = [];
$publicPath = __DIR__ . '/public';
if (substr($path, 0, 1) !== '/') {
$path = "/{$path}";
}
$manifestPath = $publicPath . '/mix-manifest.json';
if (! isset($manifests[$manifestPath])) {
if (! file_exists($manifestPath)) {
throw new Exception('The Mix manifest does not exist.');
}
$manifests[$manifestPath] = json_decode(file_get_contents($manifestPath), true);
}
$manifest = $manifests[$manifestPath];
if (! isset($manifest[$path])) {
throw new Exception("Unable to locate Mix file: {$path}.");
}
return rtrim($_ENV['MIX_BASE_PATH'], '/') . $manifest[$path];
}