Commit 30d9c9a6 authored by Tino Goratsch's avatar Tino Goratsch

made it possible to specify module paths for frontend libraries

parent bd7bd60c
......@@ -89,10 +89,10 @@ class FileResolver
*/
public function getStaticAssetPath($modulePath, $designPath, $dir = '', $file = '')
{
if (strpos($modulePath, '.') === false && !preg_match('=/$=', $modulePath)) {
if (!$this->hasTrailingSlash($modulePath)) {
$modulePath .= '/';
}
if (strpos($designPath, '.') === false && !preg_match('=/$=', $designPath)) {
if (!$this->hasTrailingSlash($designPath)) {
$designPath .= '/';
}
if (!empty($dir) && !preg_match('=/$=', $dir)) {
......@@ -109,6 +109,15 @@ class FileResolver
return $this->resolveAssetPath($modulePath, $designPath, $dir, $file);
}
/**
* @param string $path
* @return bool
*/
protected function hasTrailingSlash($path)
{
return strpos($path, '.') === false && !preg_match('=/$=', $path);
}
/**
* @param string $modulePath
* @param string $designPath
......
......@@ -44,8 +44,8 @@ class CSS extends AbstractMinifier
foreach ($this->assets->getLibraries() as $library) {
if ($library['enabled'] === true && isset($library[$this->assetGroup]) === true) {
$this->stylesheets[] = $this->fileResolver->getStaticAssetPath(
$this->systemAssetsModulePath,
$this->systemAssetsDesignPath,
!empty($library['module']) ? $library['module'] . '/Resources' : $this->systemAssetsModulePath,
!empty($library['module']) ? $library['module'] : $this->systemAssetsDesignPath,
static::ASSETS_PATH_CSS,
$library[$this->assetGroup]
);
......
......@@ -43,8 +43,8 @@ class JavaScript extends AbstractMinifier
foreach ($this->assets->getLibraries() as $library) {
if ($library['enabled'] === true && isset($library[$this->assetGroup]) === true) {
$this->javascript[] = $this->fileResolver->getStaticAssetPath(
$this->systemAssetsModulePath,
$this->systemAssetsDesignPath,
!empty($library['module']) ? $library['module'] . '/Resources' : $this->systemAssetsModulePath,
!empty($library['module']) ? $library['module'] : $this->systemAssetsDesignPath,
static::ASSETS_PATH_JS,
$library[$this->assetGroup]
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment