support subdirectories and subdomains for assets (#636)

This commit is contained in:
Kevin Papst
2019-03-12 01:02:42 +01:00
committed by GitHub
parent 1b6b957b23
commit 46655ad462
6 changed files with 67 additions and 37 deletions

View File

@@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Twig;
use Symfony\Bridge\Twig\Extension\AssetExtension as BaseAssetExtension;
class AssetExtension extends BaseAssetExtension
{
/**
* Overwritten to support subdirectories and subdomains at the same time.
*
* @param string $path
* @param null $packageName
* @return mixed|string
*/
public function getAssetUrl($path, $packageName = null)
{
return str_replace('./', 'build/', parent::getAssetUrl($path, $packageName));
}
}