diff --git a/composer.json b/composer.json index 4b5d1e5460..3276bca156 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,6 @@ "mailmotor/campaignmonitor-bundle": "^3.0", "mailmotor/mailchimp-bundle": "^4.0", "mailmotor/mailmotor-bundle": "^4.0", - "matthiasmullie/minify": "~1.3", "matthiasmullie/scrapbook": "^1.3", "pimple/pimple": "^3.2", "spoon/library": "^4.0", diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 029922a429..5b869f53a9 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -35,12 +35,10 @@ parameters: - '#Constant ACTION_RIGHTS_LEVEL not found.#' - '#Constant APPLICATION not found.#' - '#Constant BACKEND_CACHE_PATH not found.#' - - '#Constant BACKEND_CACHE_URL not found.#' - '#Constant BACKEND_CORE_PATH not found.#' - '#Constant BACKEND_MODULES_PATH not found.#' - '#Constant BACKEND_PATH not found.#' - '#Constant FRONTEND_CACHE_PATH not found.#' - - '#Constant FRONTEND_CACHE_URL not found.#' - '#Constant FRONTEND_CORE_PATH not found.#' - '#Constant FRONTEND_CORE_URL not found.#' - '#Constant FRONTEND_FILES_PATH not found.#' diff --git a/src/Backend/Cache/MinifiedCss/.gitignore b/src/Backend/Cache/MinifiedCss/.gitignore deleted file mode 100644 index c96a04f008..0000000000 --- a/src/Backend/Cache/MinifiedCss/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/src/Backend/Cache/MinifiedJs/.gitignore b/src/Backend/Cache/MinifiedJs/.gitignore deleted file mode 100644 index c96a04f008..0000000000 --- a/src/Backend/Cache/MinifiedJs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/src/Backend/Core/Engine/Form.php b/src/Backend/Core/Engine/Form.php index 321e3e101d..69b53bc681 100644 --- a/src/Backend/Core/Engine/Form.php +++ b/src/Backend/Core/Engine/Form.php @@ -68,16 +68,15 @@ public function addEditor($name, $value = null, $class = null, $classError = nul $HTML = (bool) $HTML; // we add JS because we need CKEditor - $this->header->addJS('ckeditor/ckeditor.js', 'Core', false); - $this->header->addJS('ckeditor/adapters/jquery.js', 'Core', false); - $this->header->addJS('ckfinder/ckfinder.js', 'Core', false); + $this->header->addJS('ckeditor/ckeditor.js', 'Core'); + $this->header->addJS('ckeditor/adapters/jquery.js', 'Core'); + $this->header->addJS('ckfinder/ckfinder.js', 'Core'); // add the internal link lists-file if (is_file(FRONTEND_CACHE_PATH . '/Navigation/editor_link_list_' . BackendLanguage::getWorkingLanguage() . '.js')) { $this->header->addJS( '/src/Frontend/Cache/Navigation/editor_link_list_' . BackendLanguage::getWorkingLanguage() . '.js', null, - false, true, true ); diff --git a/src/Backend/Core/Engine/Header.php b/src/Backend/Core/Engine/Header.php index ce9e6106f8..147453a4ff 100644 --- a/src/Backend/Core/Engine/Header.php +++ b/src/Backend/Core/Engine/Header.php @@ -5,7 +5,6 @@ use Common\Core\Header\Asset; use Common\Core\Header\AssetCollection; use Common\Core\Header\JsData; -use Common\Core\Header\Minifier; use Common\Core\Header\Priority; use ForkCMS\App\KernelLoader; use Symfony\Component\HttpKernel\KernelInterface; @@ -62,20 +61,8 @@ public function __construct(KernelInterface $kernel) $this->url = $container->get('url'); $this->template = $container->get('template'); - $this->cssFiles = new AssetCollection( - Minifier::css( - $container->getParameter('site.path_www'), - BACKEND_CACHE_URL . '/MinifiedCss/', - BACKEND_CACHE_PATH . '/MinifiedCss/' - ) - ); - $this->jsFiles = new AssetCollection( - Minifier::js( - $container->getParameter('site.path_www'), - BACKEND_CACHE_URL . '/MinifiedJs/', - BACKEND_CACHE_PATH . '/MinifiedJs/' - ) - ); + $this->cssFiles = new AssetCollection(); + $this->jsFiles = new AssetCollection(); $this->jsData = new JsData( [ 'interface_language' => $this->getInterfaceLanguage(), @@ -90,24 +77,24 @@ public function __construct(KernelInterface $kernel) private function addCoreJs(): void { - $this->addJS('/js/vendors/jquery.min.js', 'Core', false, true, true, Priority::core()); - $this->addJS('/js/vendors/jquery-migrate.min.js', 'Core', false, true, true, Priority::core()); - $this->addJS('/js/vendors/jquery-ui.min.js', 'Core', false, true, true, Priority::core()); - $this->addJS('/js/vendors/bootstrap.min.js', 'Core', false, true, true, Priority::core()); - $this->addJS('/js/vendors/typeahead.bundle.min.js', 'Core', false, true, true, Priority::core()); - $this->addJS('/js/vendors/bootstrap-tagsinput.min.js', 'Core', false, true, true, Priority::core()); - $this->addJS('jquery/jquery.backend.js', 'Core', true, false, true, Priority::core()); - $this->addJS('utils.js', 'Core', true, false, true, Priority::core()); - $this->addJS('backend.js', 'Core', true, false, true, Priority::core()); + $this->addJS('/js/vendors/jquery.min.js', 'Core', true, true, Priority::core()); + $this->addJS('/js/vendors/jquery-migrate.min.js', 'Core', true, true, Priority::core()); + $this->addJS('/js/vendors/jquery-ui.min.js', 'Core', true, true, Priority::core()); + $this->addJS('/js/vendors/bootstrap.min.js', 'Core', true, true, Priority::core()); + $this->addJS('/js/vendors/typeahead.bundle.min.js', 'Core', true, true, Priority::core()); + $this->addJS('/js/vendors/bootstrap-tagsinput.min.js', 'Core', true, true, Priority::core()); + $this->addJS('jquery/jquery.backend.js', 'Core', false, true, Priority::core()); + $this->addJS('utils.js', 'Core', false, true, Priority::core()); + $this->addJS('backend.js', 'Core', false, true, Priority::core()); } private function addCoreCss(): void { - $this->addCSS('/css/vendors/bootstrap-tagsinput.css', 'Core', true, true, true, Priority::core()); - $this->addCSS('/css/vendors/bootstrap-tagsinput-typeahead.css', 'Core', true, true, true, Priority::core()); - $this->addCSS('/css/vendors/bootstrap-accessibility.css', 'Core', true, true, true, Priority::core()); - $this->addCSS('screen.css', 'Core', false, true, true, Priority::core()); - $this->addCSS('debug.css', 'Core', false, true, true, Priority::debug()); + $this->addCSS('/css/vendors/bootstrap-tagsinput.css', 'Core', true, true, Priority::core()); + $this->addCSS('/css/vendors/bootstrap-tagsinput-typeahead.css', 'Core', true, true, Priority::core()); + $this->addCSS('/css/vendors/bootstrap-accessibility.css', 'Core', true, true, Priority::core()); + $this->addCSS('screen.css', 'Core', false, true, Priority::core()); + $this->addCSS('debug.css', 'Core', false, true, Priority::debug()); } private function buildPathForModule(string $fileName, string $module, string $subDirectory): string @@ -134,7 +121,6 @@ private function buildPathForModule(string $fileName, string $module, string $su * @param string $module The module wherein the file is located. * @param bool $overwritePath Should we overwrite the full path? * An external url will always be handled with $overwritePath as true. - * @param bool $minify Should the CSS be minified? * @param bool $addTimestamp May we add a timestamp for caching purposes? * @param Priority $priority the files are added based on the priority * defaults to standard for full links or core or module for core or module css @@ -143,22 +129,19 @@ public function addCSS( string $file, ?string $module = null, bool $overwritePath = false, - bool $minify = true, bool $addTimestamp = true, ?Priority $priority = null ): void { $module ??= $this->url->getModule(); $isExternalUrl = $this->get('fork.validator.url')->isExternalUrl($file); $overwritePath = $overwritePath || $isExternalUrl; // external urls always overwrite the path - $minify = $minify && !$isExternalUrl; $this->cssFiles->add( new Asset( $overwritePath ? $file : $this->buildPathForModule($file, $module, 'Layout/Css'), $addTimestamp, $priority ?? ($overwritePath ? Priority::standard() : Priority::forModule($module)) - ), - $minify + ) ); } @@ -169,7 +152,6 @@ public function addCSS( * * @param string $file The file to load. * @param string $module The module wherein the file is located. - * @param bool $minify Should the javascript be minified? * @param bool $overwritePath Should we overwrite the full path? * An external url will always be handled with $overwritePath as true. * @param bool $addTimestamp May we add a timestamp for caching purposes? @@ -179,7 +161,6 @@ public function addCSS( public function addJS( string $file, ?string $module = null, - bool $minify = true, bool $overwritePath = false, bool $addTimestamp = true, ?Priority $priority = null @@ -187,7 +168,6 @@ public function addJS( $module ??= $this->url->getModule(); $isExternalUrl = $this->get('fork.validator.url')->isExternalUrl($file); $overwritePath = $overwritePath || $isExternalUrl; // external urls always overwrite the path - $minify = $minify && !$isExternalUrl; $this->jsFiles->add( new Asset( @@ -195,7 +175,6 @@ public function addJS( $addTimestamp, $priority ?? ($overwritePath ? Priority::standard() : Priority::forModule($module)) ), - $minify ); } diff --git a/src/Backend/Modules/FormBuilder/Resources/config/commands.yml b/src/Backend/Modules/FormBuilder/Resources/config/commands.yml index 0306a0b061..1b3ae42f29 100644 --- a/src/Backend/Modules/FormBuilder/Resources/config/commands.yml +++ b/src/Backend/Modules/FormBuilder/Resources/config/commands.yml @@ -5,3 +5,5 @@ services: public: true Backend\Modules\FormBuilder\Command\CopyFormWidgetsToOtherLocaleHandler: + arguments: + $database: '@database' diff --git a/src/Backend/Modules/Location/Resources/config/commands.yml b/src/Backend/Modules/Location/Resources/config/commands.yml index 464691da41..fd0d45842a 100644 --- a/src/Backend/Modules/Location/Resources/config/commands.yml +++ b/src/Backend/Modules/Location/Resources/config/commands.yml @@ -5,3 +5,5 @@ services: public: true Backend\Modules\Location\Command\CopyLocationWidgetsToOtherLocaleHandler: + arguments: + $database: '@database' diff --git a/src/Backend/Modules/MediaLibrary/Domain/MediaGroup/MediaGroupType.php b/src/Backend/Modules/MediaLibrary/Domain/MediaGroup/MediaGroupType.php index 7571f4ae99..22fd60b44a 100644 --- a/src/Backend/Modules/MediaLibrary/Domain/MediaGroup/MediaGroupType.php +++ b/src/Backend/Modules/MediaLibrary/Domain/MediaGroup/MediaGroupType.php @@ -203,10 +203,10 @@ public static function parseFiles(): void $header = Model::get('header'); // Add "fine-uploader" css/js - $header->addCSS('/css/vendors/fine-uploader/fine-uploader-new.min.css', null, true, false); + $header->addCSS('/css/vendors/fine-uploader/fine-uploader-new.min.css', null, true); $header->addCSS('/css/vendors/cropper.css', null, true); - $header->addJS('/js/vendors/jquery.fine-uploader.min.js', null, false, true); - $header->addJS('/js/vendors/cropper.js', null, true, true); + $header->addJS('/js/vendors/jquery.fine-uploader.min.js', null, true); + $header->addJS('/js/vendors/cropper.js', null, true); $header->addCSS('MediaLibrary.css', 'MediaLibrary'); $header->addJS('MediaLibraryFolders.js', 'MediaLibrary'); diff --git a/src/Backend/Modules/Pages/Actions/Add.php b/src/Backend/Modules/Pages/Actions/Add.php index d9a7778c2d..70ac505fd5 100644 --- a/src/Backend/Modules/Pages/Actions/Add.php +++ b/src/Backend/Modules/Pages/Actions/Add.php @@ -82,10 +82,10 @@ public function execute(): void parent::execute(); // add js - $this->header->addJS('jstree/jquery.tree.js', null, false); - $this->header->addJS('jstree/lib/jquery.cookie.js', null, false); - $this->header->addJS('jstree/plugins/jquery.tree.cookie.js', null, false); - $this->header->addJS('/js/vendors/SimpleAjaxUploader.min.js', 'Core', false, true); + $this->header->addJS('jstree/jquery.tree.js'); + $this->header->addJS('jstree/lib/jquery.cookie.js'); + $this->header->addJS('jstree/plugins/jquery.tree.cookie.js'); + $this->header->addJS('/js/vendors/SimpleAjaxUploader.min.js', null, true); // get the templates $this->templates = BackendExtensionsModel::getTemplates(); diff --git a/src/Backend/Modules/Pages/Actions/Edit.php b/src/Backend/Modules/Pages/Actions/Edit.php index bb4f097013..2c03b31001 100644 --- a/src/Backend/Modules/Pages/Actions/Edit.php +++ b/src/Backend/Modules/Pages/Actions/Edit.php @@ -93,7 +93,7 @@ public function execute(): void $this->header->addJS('jstree/jquery.tree.js'); $this->header->addJS('jstree/lib/jquery.cookie.js'); $this->header->addJS('jstree/plugins/jquery.tree.cookie.js'); - $this->header->addJS('/js/vendors/SimpleAjaxUploader.min.js', null, false, true); + $this->header->addJS('/js/vendors/SimpleAjaxUploader.min.js', null, true); // get the templates $this->templates = BackendExtensionsModel::getTemplates(); diff --git a/src/Common/Core/Header/AssetCollection.php b/src/Common/Core/Header/AssetCollection.php index 0fd7628a3b..3e5c2f89d2 100644 --- a/src/Common/Core/Header/AssetCollection.php +++ b/src/Common/Core/Header/AssetCollection.php @@ -9,16 +9,8 @@ final class AssetCollection /** @var Asset[] */ private $assets = []; - public function __construct(private readonly Minifier $minifier) + public function add(Asset $asset): void { - } - - public function add(Asset $asset, bool $minify = true): void - { - if ($minify) { - $asset = $this->minifier->minify($asset); - } - // we already have it we don't need to add it again if (array_key_exists($asset->getFile(), $this->assets)) { return; diff --git a/src/Common/Core/Header/Minifier.php b/src/Common/Core/Header/Minifier.php deleted file mode 100644 index 0a67f619b5..0000000000 --- a/src/Common/Core/Header/Minifier.php +++ /dev/null @@ -1,60 +0,0 @@ -getParameter('kernel.debug')) { - return $asset; - } - - $fileName = md5($asset->getFile()) . '.' . $this->cacheFileExtension; - $filePath = $this->basePath . $asset->getFile(); - $cacheUrl = $this->baseCacheUrl . $fileName; - $cachePath = $this->baseCachePath . $fileName; - - // check that file does not yet exist or has been updated already - if (is_file($cachePath) && filemtime($filePath) <= filemtime($cachePath)) { - return $asset->forCacheUrl($cacheUrl); - } - - // clone the minify class since there is no way to clear the added files - $minifier = clone $this->minifyClass; - $minifier->add($filePath); - $minifier->minify($cachePath); - - return $asset->forCacheUrl($cacheUrl); - } -} diff --git a/src/Common/Form/DatePickerType.php b/src/Common/Form/DatePickerType.php index a417cc8e70..ccce8c090b 100644 --- a/src/Common/Form/DatePickerType.php +++ b/src/Common/Form/DatePickerType.php @@ -27,14 +27,14 @@ public function buildForm(FormBuilderInterface $builder, array $options): void parent::buildForm($builder, $options); if ($this->header instanceof BackendHeader) { - $this->header->addJS('/js/vendors/bootstrap-datepicker.min.js', null, false, true, true, Priority::core()); - $this->header->addCSS('/css/vendors/bootstrap-datepicker3.standalone.min.css', null, true, false, true, Priority::core()); + $this->header->addJS('/js/vendors/bootstrap-datepicker.min.js', null, true, true, Priority::core()); + $this->header->addCSS('/css/vendors/bootstrap-datepicker3.standalone.min.css', null, true, true, Priority::core()); return; } - $this->header->addJS('/js/vendors/bootstrap-datepicker.min.js', false, true, Priority::core()); - $this->header->addCSS('/css/vendors/bootstrap-datepicker3.standalone.min.css', false, true, Priority::core()); + $this->header->addJS('/js/vendors/bootstrap-datepicker.min.js', true, Priority::core()); + $this->header->addCSS('/css/vendors/bootstrap-datepicker3.standalone.min.css', true, Priority::core()); } public function configureOptions(OptionsResolver $resolver): void diff --git a/src/Common/Tests/Core/Header/AssetCollectionTest.php b/src/Common/Tests/Core/Header/AssetCollectionTest.php index bd954ee674..31467b298c 100644 --- a/src/Common/Tests/Core/Header/AssetCollectionTest.php +++ b/src/Common/Tests/Core/Header/AssetCollectionTest.php @@ -4,7 +4,6 @@ use Common\Core\Header\Asset; use Common\Core\Header\AssetCollection; -use Common\Core\Header\Minifier; use Common\Core\Header\Priority; use PHPUnit\Framework\TestCase; @@ -12,7 +11,7 @@ class AssetCollectionTest extends TestCase { public function testAddAssetToCollection(): void { - $assetCollection = new AssetCollection(Minifier::js(__DIR__, __DIR__, __DIR__)); + $assetCollection = new AssetCollection(); $asset1 = new Asset(__DIR__ . '/../../../../../js/vendors/jquery-ui.min.js', false, Priority::standard()); $asset2 = new Asset(__DIR__ . '/../../../../../js/vendors/slick.min.js', false, Priority::module()); @@ -20,11 +19,11 @@ public function testAddAssetToCollection(): void $asset4 = new Asset(__DIR__ . '/../../../../../js/vendors/bootstrap.min.js', false, Priority::core()); $asset5 = new Asset(__DIR__ . '/../../../../../js/vendors/jquery.min.js', false, Priority::core()); - $assetCollection->add($asset1, false); - $assetCollection->add($asset2, false); - $assetCollection->add($asset3, false); - $assetCollection->add($asset4, false); - $assetCollection->add($asset5, false); + $assetCollection->add($asset1); + $assetCollection->add($asset2); + $assetCollection->add($asset3); + $assetCollection->add($asset4); + $assetCollection->add($asset5); $unorderedAssets = $assetCollection->getAssets(); self::assertEquals($asset1, $unorderedAssets[$asset1->getFile()]); diff --git a/src/Console/Core/CacheClearCommand.php b/src/Console/Core/CacheClearCommand.php index 34a040db2a..868facddf2 100644 --- a/src/Console/Core/CacheClearCommand.php +++ b/src/Console/Core/CacheClearCommand.php @@ -25,14 +25,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->removeFilesInFolder('/src/Frontend/Cache/CompiledTemplates', $io, 'frontend compiled templates'); $this->removeFilesInFolder('/src/Frontend/Cache/Locale', $io, 'frontend cached locale'); - $this->removeFilesInFolder('/src/Frontend/Cache/MinifiedCss', $io, 'frontend minified css'); - $this->removeFilesInFolder('/src/Frontend/Cache/MinifiedJs', $io, 'frontend minified js'); $this->removeFilesInFolder('/src/Frontend/Cache/Navigation', $io, 'frontend cached navigation'); $this->removeFilesInFolder('/src/Backend/Cache/CompiledTemplates', $io, 'backend compiled templates'); $this->removeFilesInFolder('/src/Backend/Cache/Locale', $io, 'backend cached locale'); - $this->removeFilesInFolder('/src/Backend/Cache/MinifiedCss', $io, 'backend minified css'); - $this->removeFilesInFolder('/src/Backend/Cache/MinifiedJs', $io, 'backend minified js'); $symfonyCacheClearCommand = $this->getApplication()->find('cache:clear'); $symfonyCacheClearCommand->run(new ArrayInput(['--no-warmup' => true]), $output); diff --git a/src/Frontend/Cache/MinifiedCss/.gitignore b/src/Frontend/Cache/MinifiedCss/.gitignore deleted file mode 100644 index c96a04f008..0000000000 --- a/src/Frontend/Cache/MinifiedCss/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/src/Frontend/Cache/MinifiedJs/.gitignore b/src/Frontend/Cache/MinifiedJs/.gitignore deleted file mode 100644 index c96a04f008..0000000000 --- a/src/Frontend/Cache/MinifiedJs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/src/Frontend/Core/Engine/Base/Block.php b/src/Frontend/Core/Engine/Base/Block.php index 3b59fb22d3..939a59e492 100644 --- a/src/Frontend/Core/Engine/Base/Block.php +++ b/src/Frontend/Core/Engine/Base/Block.php @@ -124,13 +124,11 @@ public function __construct(KernelInterface $kernel, string $module, string $act * * @param string $file The path for the CSS-file that should be loaded. * @param bool $overwritePath Whether or not to add the module to this path. Module path is added by default. - * @param bool $minify Should the CSS be minified? * @param bool $addTimestamp May we add a timestamp for caching purposes? */ public function addCSS( string $file, bool $overwritePath = false, - bool $minify = true, bool $addTimestamp = true ): void { // external urls always overwrite the path @@ -144,7 +142,6 @@ public function addCSS( // add css to the header $this->header->addCSS( $file, - $minify, $addTimestamp, $overwritePath ? Priority::standard() : Priority::forModule($this->getModule()) ); @@ -155,13 +152,11 @@ public function addCSS( * * @param string $file The path to the javascript-file that should be loaded. * @param bool $overwritePath Whether or not to add the module to this path. Module path is added by default. - * @param bool $minify Should the file be minified? * @param bool $addTimestamp May we add a timestamp for caching purposes? */ public function addJS( string $file, bool $overwritePath = false, - bool $minify = true, bool $addTimestamp = true ): void { // external urls always overwrite the path @@ -175,7 +170,6 @@ public function addJS( // add js to the header $this->header->addJS( $file, - $minify, $addTimestamp, $overwritePath ? Priority::standard() : Priority::forModule($this->getModule()) ); @@ -209,7 +203,6 @@ public function execute(): void $this->header->addJS( $frontendModuleUrl . '/' . $this->getModule() . '.js', true, - true, Priority::module() ); } @@ -219,7 +212,6 @@ public function execute(): void $this->header->addJS( $frontendModuleUrl . '/' . $this->getAction() . '.js', true, - true, Priority::module() ); } diff --git a/src/Frontend/Core/Engine/Base/Widget.php b/src/Frontend/Core/Engine/Base/Widget.php index 1f673cb0f5..ca29fb0bff 100644 --- a/src/Frontend/Core/Engine/Base/Widget.php +++ b/src/Frontend/Core/Engine/Base/Widget.php @@ -96,13 +96,11 @@ public function __construct(KernelInterface $kernel, string $module, string $act * * @param string $file The path for the CSS-file that should be loaded. * @param bool $overwritePath Whether or not to add the module to this path. Module path is added by default. - * @param bool $minify Should the CSS be minified? * @param bool $addTimestamp May we add a timestamp for caching purposes? */ public function addCSS( string $file, bool $overwritePath = false, - bool $minify = true, bool $addTimestamp = true ): void { // external urls always overwrite the path @@ -112,7 +110,7 @@ public function addCSS( $file = '/src/Frontend/Modules/' . $this->getModule() . '/Layout/Css/' . $file; } - $this->header->addCSS($file, $minify, $addTimestamp, Priority::widget()); + $this->header->addCSS($file, $addTimestamp, Priority::widget()); } /** @@ -120,13 +118,11 @@ public function addCSS( * * @param string $file The path to the javascript-file that should be loaded. * @param bool $overwritePath Whether or not to add the module to this path. Module path is added by default. - * @param bool $minify Should the file be minified? * @param bool $addTimestamp May we add a timestamp for caching purposes? */ public function addJS( string $file, bool $overwritePath = false, - bool $minify = true, bool $addTimestamp = true ): void { // external urls always overwrite the path @@ -136,7 +132,7 @@ public function addJS( $file = '/src/Frontend/Modules/' . $this->getModule() . '/Js/' . $file; } - $this->header->addJS($file, $minify, $addTimestamp, Priority::widget()); + $this->header->addJS($file, $addTimestamp, Priority::widget()); } /** @@ -167,7 +163,6 @@ public function execute(): void $this->header->addJS( $frontendModuleUrl . '/' . $this->getModule() . '.js', true, - true, Priority::widget() ); } @@ -177,7 +172,6 @@ public function execute(): void $this->header->addJS( $frontendModuleUrl . '/' . $this->getAction() . '.js', true, - true, Priority::widget() ); } diff --git a/src/Frontend/Core/Header/Header.php b/src/Frontend/Core/Header/Header.php index 71340e0c18..236900122a 100644 --- a/src/Frontend/Core/Header/Header.php +++ b/src/Frontend/Core/Header/Header.php @@ -5,7 +5,6 @@ use Common\Core\Header\Asset; use Common\Core\Header\AssetCollection; use Common\Core\Header\JsData; -use Common\Core\Header\Minifier; use Common\Core\Header\Priority; use ForkCMS\App\KernelLoader; use ForkCMS\Google\TagManager\TagManager; @@ -103,20 +102,8 @@ public function __construct(KernelInterface $kernel) $this->template = $container->get('templating'); $this->url = $container->get('url'); - $this->cssFiles = new AssetCollection( - Minifier::css( - $container->getParameter('site.path_www'), - FRONTEND_CACHE_URL . '/MinifiedCss/', - FRONTEND_CACHE_PATH . '/MinifiedCss/' - ) - ); - $this->jsFiles = new AssetCollection( - Minifier::js( - $container->getParameter('site.path_www'), - FRONTEND_CACHE_URL . '/MinifiedJs/', - FRONTEND_CACHE_PATH . '/MinifiedJs/' - ) - ); + $this->cssFiles = new AssetCollection(); + $this->jsFiles = new AssetCollection(); $jsData = [ 'LANGUAGE' => Locale::frontendLanguage(), @@ -131,59 +118,53 @@ public function __construct(KernelInterface $kernel) // debug stylesheet if ($container->getParameter('kernel.debug')) { - $this->addCSS('/src/Frontend/Core/Layout/Css/debug.css', true, true, Priority::debug()); + $this->addCSS('/src/Frontend/Core/Layout/Css/debug.css', true, Priority::debug()); } // add default javascript-files - $this->addJS('/js/vendors/jquery.min.js', false, true, Priority::core()); - $this->addJS('/src/Frontend/Core/Js/jquery/jquery.frontend.js', true, true, Priority::core()); - $this->addJS('/src/Frontend/Core/Js/utils.js', true, true, Priority::core()); - $this->addJS('/src/Frontend/Core/Js/frontend.js', true, true, Priority::core()); + $this->addJS('/js/vendors/jquery.min.js', true, Priority::core()); + $this->addJS('/src/Frontend/Core/Js/jquery/jquery.frontend.js', true, Priority::core()); + $this->addJS('/src/Frontend/Core/Js/utils.js', true, Priority::core()); + $this->addJS('/src/Frontend/Core/Js/frontend.js', true, Priority::core()); // @custom for SumoCoders - $this->addJS('/src/Frontend/Core/bundle.js', false, true, Priority::core()); - $this->addJS('/src/Frontend/Core/icons.js', false, true, Priority::core()); + $this->addJS('/src/Frontend/Core/bundle.js', true, Priority::core()); + $this->addJS('/src/Frontend/Core/icons.js', true, Priority::core()); } /** * Add a CSS file into the array * * @param string $file The path for the CSS-file that should be loaded. - * @param bool $minify Should the CSS be minified? * @param bool $addTimestamp May we add a timestamp for caching purposes? * @param Priority|null $priority Provides a way to change the order that things are loaded */ public function addCSS( string $file, - bool $minify = true, bool $addTimestamp = true, ?Priority $priority = null ): void { $isExternalUrl = $this->get('fork.validator.url')->isExternalUrl($file); $file = $isExternalUrl ? $file : Theme::getPath($file); - $minify = $minify && !$isExternalUrl; - $this->cssFiles->add(new Asset($file, $addTimestamp, $priority), $minify); + $this->cssFiles->add(new Asset($file, $addTimestamp, $priority)); } /** * Add a javascript file into the array * * @param string $file The path to the javascript-file that should be loaded. - * @param bool $minify Should the javascript be minified? * @param bool $addTimestamp May we add a timestamp for caching purposes? * @param Priority|null $priority Provides a way to change the order that things are loaded */ public function addJS( string $file, - bool $minify = true, bool $addTimestamp = true, ?Priority $priority = null ): void { $isExternalUrl = $this->get('fork.validator.url')->isExternalUrl($file); $file = $isExternalUrl ? $file : Theme::getPath($file); - $minify = $minify && !$isExternalUrl; - $this->jsFiles->add(new Asset($file, $addTimestamp, $priority), $minify); + $this->jsFiles->add(new Asset($file, $addTimestamp, $priority)); } /** diff --git a/src/Frontend/Modules/MediaLibrary/Widgets/Lightbox.php b/src/Frontend/Modules/MediaLibrary/Widgets/Lightbox.php index 3c47b722c6..69e3a6a6ae 100644 --- a/src/Frontend/Modules/MediaLibrary/Widgets/Lightbox.php +++ b/src/Frontend/Modules/MediaLibrary/Widgets/Lightbox.php @@ -27,8 +27,8 @@ public function execute(): void private function addLightboxJS(): void { - $this->addJS('/js/vendors/photoswipe.min.js', true, false); - $this->addJS('/js/vendors/photoswipe-ui-default.min.js', true, false); + $this->addJS('/js/vendors/photoswipe.min.js', true); + $this->addJS('/js/vendors/photoswipe-ui-default.min.js', true); } private function addLightboxCSS(): void diff --git a/src/Frontend/Modules/Search/Actions/Index.php b/src/Frontend/Modules/Search/Actions/Index.php index 9c9463969f..49e02d36e4 100644 --- a/src/Frontend/Modules/Search/Actions/Index.php +++ b/src/Frontend/Modules/Search/Actions/Index.php @@ -167,7 +167,7 @@ private function getCanonicalUrl(string $query): string private function parse(): void { - $this->addJS('/js/vendors/typeahead.bundle.min.js', true, false); + $this->addJS('/js/vendors/typeahead.bundle.min.js', true); $this->addCSS('Search.css'); $this->form->parse($this->template); diff --git a/src/Frontend/Modules/Search/Widgets/Form.php b/src/Frontend/Modules/Search/Widgets/Form.php index 7904ed5dab..1105020ca7 100644 --- a/src/Frontend/Modules/Search/Widgets/Form.php +++ b/src/Frontend/Modules/Search/Widgets/Form.php @@ -16,7 +16,7 @@ public function execute(): void parent::execute(); $this->loadTemplate(); - $this->addJS('/js/vendors/typeahead.bundle.min.js', true, false); + $this->addJS('/js/vendors/typeahead.bundle.min.js', true); $this->addCSS('Search.css'); $form = new FrontendForm('search', FrontendNavigation::getUrlForBlock('Search'), 'get', null, false);