js css
This commit is contained in:
@@ -22,6 +22,20 @@ function base_path(string $path = ''): string
|
||||
return $path === '' ? $base : $base . '/' . ltrim($path, '/');
|
||||
}
|
||||
|
||||
function versioned_asset(string $path): string
|
||||
{
|
||||
$assetPath = '/' . ltrim($path, '/');
|
||||
$pathWithoutQuery = strtok($assetPath, '?') ?: $assetPath;
|
||||
$querySeparator = str_contains($assetPath, '?') ? '&' : '?';
|
||||
$publicPath = base_path('public' . $pathWithoutQuery);
|
||||
|
||||
if (!is_file($publicPath)) {
|
||||
return $assetPath;
|
||||
}
|
||||
|
||||
return $assetPath . $querySeparator . filemtime($publicPath);
|
||||
}
|
||||
|
||||
function view(string $template, array $data = []): void
|
||||
{
|
||||
View::render($template, $data);
|
||||
|
||||
Reference in New Issue
Block a user