support subdirectories and subdomains for assets (#636)
This commit is contained in:
@@ -24,7 +24,6 @@ Kimai is a [multi-language application](https://www.kimai.org/documentation/tran
|
||||
|
||||
- PHP 7.1.3 or higher (test your system compatibility with the [requirements-checker](http://symfony.com/doc/current/reference/requirements.html))
|
||||
- The PHP extensions [xml](http://php.net/manual/en/book.xml.php), [mbstring](http://php.net/manual/en/book.mbstring.php), [gd](http://php.net/manual/en/book.image.php), [intl](https://php.net/manual/en/book.intl.php), [zip](https://php.net/manual/en/book.zip.php) and [PDO](https://php.net/manual/en/book.pdo.php) with either [pdo_sqlite](https://php.net/manual/en/ref.pdo-sqlite.php) or [pdo_mysql](https://php.net/manual/en/ref.pdo-mysql.php) enabled
|
||||
- Kimai needs its own sub-domain or you need to [recompile the frontend assets](https://www.kimai.org/documentation/developers.html) for usage in a sub-directory
|
||||
- If you use MariaDB, make sure its at least v10.2.7 (see [FAQ](https://www.kimai.org/documentation/faq.html))
|
||||
- A modern browser, Kimai v2 might be broken on old browsers like IE 10
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,28 +1,28 @@
|
||||
{
|
||||
"build/app.js": "/build/app.js?f4920c78e36b8782bf97",
|
||||
"build/app.css": "/build/app.css?8a23cdbf97765f6025693a6288873cd2",
|
||||
"build/images/blue@2x.png": "/build/images/blue@2x.png?2694acfd",
|
||||
"build/images/blue.png": "/build/images/blue.png?96f8a905",
|
||||
"build/fonts/fa-solid-900.woff2": "/build/fonts/fa-solid-900.woff2?e8a92a29",
|
||||
"build/images/fa-solid-900.svg": "/build/images/fa-solid-900.svg?666a82cb",
|
||||
"build/images/glyphicons-halflings-regular.svg": "/build/images/glyphicons-halflings-regular.svg?89889688",
|
||||
"build/fonts/glyphicons-halflings-regular.eot": "/build/fonts/glyphicons-halflings-regular.eot?f4769f9b",
|
||||
"build/fonts/fa-solid-900.ttf": "/build/fonts/fa-solid-900.ttf?a7a790d4",
|
||||
"build/fonts/fa-brands-400.eot": "/build/fonts/fa-brands-400.eot?69b310ed",
|
||||
"build/fonts/fa-regular-400.eot": "/build/fonts/fa-regular-400.eot?0b7928f6",
|
||||
"build/fonts/fa-brands-400.woff": "/build/fonts/fa-brands-400.woff?e9f83339",
|
||||
"build/fonts/glyphicons-halflings-regular.woff2": "/build/fonts/glyphicons-halflings-regular.woff2?448c34a5",
|
||||
"build/fonts/fa-solid-900.eot": "/build/fonts/fa-solid-900.eot?0b93480e",
|
||||
"build/fonts/fa-solid-900.woff": "/build/fonts/fa-solid-900.woff?dfc040d5",
|
||||
"build/fonts/fa-regular-400.woff": "/build/fonts/fa-regular-400.woff?d9e29124",
|
||||
"build/fonts/fa-regular-400.woff2": "/build/fonts/fa-regular-400.woff2?930c1264",
|
||||
"build/images/fa-regular-400.svg": "/build/images/fa-regular-400.svg?4e41caaf",
|
||||
"build/fonts/fa-regular-400.ttf": "/build/fonts/fa-regular-400.ttf?cdd8fa76",
|
||||
"build/fonts/fa-brands-400.ttf": "/build/fonts/fa-brands-400.ttf?d94572dd",
|
||||
"build/fonts/glyphicons-halflings-regular.woff": "/build/fonts/glyphicons-halflings-regular.woff?fa277232",
|
||||
"build/fonts/fa-brands-400.woff2": "/build/fonts/fa-brands-400.woff2?66f625f1",
|
||||
"build/fonts/glyphicons-halflings-regular.ttf": "/build/fonts/glyphicons-halflings-regular.ttf?e18bbf61",
|
||||
"build/images/fa-brands-400.svg": "/build/images/fa-brands-400.svg?5da7e33c",
|
||||
"build/images/default_avatar.png": "/build/images/default_avatar.png?fc197350",
|
||||
"build/images/signature.png": "/build/images/signature.png?5f58501e"
|
||||
"build/app.js": "./app.js?689ff5ff33eeac75779e",
|
||||
"build/app.css": "./app.css?d1c5aa3942706f7bffb181e234e112de",
|
||||
"build/images/blue@2x.png": "./images/blue@2x.png?2694acfd",
|
||||
"build/images/blue.png": "./images/blue.png?96f8a905",
|
||||
"build/fonts/fa-solid-900.woff2": "./fonts/fa-solid-900.woff2?e8a92a29",
|
||||
"build/images/fa-solid-900.svg": "./images/fa-solid-900.svg?666a82cb",
|
||||
"build/images/glyphicons-halflings-regular.svg": "./images/glyphicons-halflings-regular.svg?89889688",
|
||||
"build/fonts/glyphicons-halflings-regular.eot": "./fonts/glyphicons-halflings-regular.eot?f4769f9b",
|
||||
"build/fonts/fa-solid-900.ttf": "./fonts/fa-solid-900.ttf?a7a790d4",
|
||||
"build/fonts/fa-brands-400.eot": "./fonts/fa-brands-400.eot?69b310ed",
|
||||
"build/fonts/fa-regular-400.eot": "./fonts/fa-regular-400.eot?0b7928f6",
|
||||
"build/fonts/fa-brands-400.woff": "./fonts/fa-brands-400.woff?e9f83339",
|
||||
"build/fonts/glyphicons-halflings-regular.woff2": "./fonts/glyphicons-halflings-regular.woff2?448c34a5",
|
||||
"build/fonts/fa-solid-900.eot": "./fonts/fa-solid-900.eot?0b93480e",
|
||||
"build/fonts/fa-solid-900.woff": "./fonts/fa-solid-900.woff?dfc040d5",
|
||||
"build/fonts/fa-regular-400.woff": "./fonts/fa-regular-400.woff?d9e29124",
|
||||
"build/fonts/fa-regular-400.woff2": "./fonts/fa-regular-400.woff2?930c1264",
|
||||
"build/images/fa-regular-400.svg": "./images/fa-regular-400.svg?4e41caaf",
|
||||
"build/fonts/fa-regular-400.ttf": "./fonts/fa-regular-400.ttf?cdd8fa76",
|
||||
"build/fonts/fa-brands-400.ttf": "./fonts/fa-brands-400.ttf?d94572dd",
|
||||
"build/fonts/glyphicons-halflings-regular.woff": "./fonts/glyphicons-halflings-regular.woff?fa277232",
|
||||
"build/fonts/fa-brands-400.woff2": "./fonts/fa-brands-400.woff2?66f625f1",
|
||||
"build/fonts/glyphicons-halflings-regular.ttf": "./fonts/glyphicons-halflings-regular.ttf?e18bbf61",
|
||||
"build/images/fa-brands-400.svg": "./images/fa-brands-400.svg?5da7e33c",
|
||||
"build/images/default_avatar.png": "./images/default_avatar.png?fc197350",
|
||||
"build/images/signature.png": "./images/signature.png?5f58501e"
|
||||
}
|
||||
27
src/Twig/AssetExtension.php
Normal file
27
src/Twig/AssetExtension.php
Normal 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));
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,12 @@ Encore
|
||||
// the project directory where compiled assets will be stored
|
||||
.setOutputPath('public/build/')
|
||||
|
||||
// the public path used by the web server to access the previous directory
|
||||
.setPublicPath('/build/')
|
||||
// the public path is ONLY used to reference fonts from within CSS
|
||||
// you can ignore the warning message triggered by webpack encore
|
||||
.setPublicPath('./')
|
||||
|
||||
// used by the asset twig helper to find the correct entry from manifest.json (prefix for each manifest entry)
|
||||
.setManifestKeyPrefix('build/')
|
||||
|
||||
// empty the outputPath directory before each build
|
||||
.cleanupOutputBeforeBuild()
|
||||
|
||||
Reference in New Issue
Block a user