diff --git a/module/VuFindTheme/src/VuFindTheme/Minify/CSS.php b/module/VuFindTheme/src/VuFindTheme/Minify/CSS.php new file mode 100644 index 0000000000000000000000000000000000000000..77460d4ef0593bd0297d1b317bb4e752481c9bae --- /dev/null +++ b/module/VuFindTheme/src/VuFindTheme/Minify/CSS.php @@ -0,0 +1,54 @@ +<?php +/** + * CSS minifier extension + * + * PHP version 5 + * + * Copyright (C) The National Library of Finland 2017. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind + * @package View_Helpers + * @author Ere Maijala <ere.maijala@helsinki.fi> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +namespace VuFindTheme\Minify; + +/** + * CSS minifier extensions + * + * @category VuFind + * @package View_Helpers + * @author Ere Maijala <ere.maijala@helsinki.fi> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:testing:unit_tests Wiki + */ +class CSS extends \MatthiasMullie\Minify\CSS +{ + /** + * Return a converter to update relative paths to be relative to the new + * destination. + * + * @param string $source Source path + * @param string $target Target path + * + * @return \MatthiasMullie\PathConverter\ConverterInterface + */ + protected function getPathConverter($source, $target) + { + return new PathConverter($source, $target); + } +} diff --git a/module/VuFindTheme/src/VuFindTheme/Minify/PathConverter.php b/module/VuFindTheme/src/VuFindTheme/Minify/PathConverter.php new file mode 100644 index 0000000000000000000000000000000000000000..1b2254c153f7bff7bb91abb7e8d3a7195f00b866 --- /dev/null +++ b/module/VuFindTheme/src/VuFindTheme/Minify/PathConverter.php @@ -0,0 +1,56 @@ +<?php +/** + * CSS path converter extension + * + * PHP version 5 + * + * Copyright (C) The National Library of Finland 2017. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind + * @package View_Helpers + * @author Ere Maijala <ere.maijala@helsinki.fi> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +namespace VuFindTheme\Minify; + +/** + * CSS path converter extension + * + * @category VuFind + * @package View_Helpers + * @author Ere Maijala <ere.maijala@helsinki.fi> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +class PathConverter extends \MatthiasMullie\PathConverter\Converter +{ + /** + * Normalize path. + * + * @param string $path Path + * + * @return string + */ + protected function normalize($path) + { + $path = parent::normalize($path); + + $path = str_replace('/local/cache/public', '/cache', $path); + + return $path; + } +} diff --git a/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php b/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php index f7c7fe6dc2a59a7d151e09a75c31e512935d528b..24dd1dda5848d478a2a9ceb8dee16470c7feec9a 100644 --- a/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php +++ b/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php @@ -24,7 +24,7 @@ * @package View_Helpers * @author Demian Katz <demian.katz@villanova.edu> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link https://vufind.org/wiki/development:testing:unit_tests Wiki + * @link https://vufind.org/wiki/development Wiki */ namespace VuFindTheme\View\Helper; use VuFindTheme\ThemeInfo; diff --git a/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadLink.php b/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadLink.php index 0fbd23405da3c75e28618051df5bdcb4a373d4bc..c9478a4ae3d52b35e0a82900a5453e34dbc6ac47 100644 --- a/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadLink.php +++ b/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadLink.php @@ -203,6 +203,6 @@ class HeadLink extends \Zend\View\Helper\HeadLink */ protected function getMinifier() { - return new \MatthiasMullie\Minify\CSS(); + return new \VuFindTheme\Minify\CSS(); } }