new minifier libraries

Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
Andy Miller
2025-11-09 11:58:35 +00:00
parent 07ac3d3bb9
commit 6b0c0486aa
3 changed files with 125 additions and 133 deletions

View File

@@ -50,7 +50,8 @@
"dragonmantank/cron-expression": "^3.3",
"willdurand/negotiation": "^3.1",
"rhukster/dom-sanitizer": "^1.0",
"matthiasmullie/minify": "^1.3",
"tubalmartin/cssmin": "^4.1",
"tedivm/jshrink": "^1.7",
"donatj/phpuseragentparser": "~1.9",
"guzzlehttp/psr7": "^2.7",
"filp/whoops": "~2.16",

242
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5f161a524f59ffb5b6fa7d5789f04427",
"content-hash": "b39160710f90a14d6be86b6c7237404a",
"packages": [
{
"name": "antoligy/dom-string-iterators",
@@ -1022,129 +1022,6 @@
},
"time": "2024-11-18T09:09:55+00:00"
},
{
"name": "matthiasmullie/minify",
"version": "1.3.75",
"source": {
"type": "git",
"url": "https://github.com/matthiasmullie/minify.git",
"reference": "76ba4a5f555fd7bf4aa408af608e991569076671"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/76ba4a5f555fd7bf4aa408af608e991569076671",
"reference": "76ba4a5f555fd7bf4aa408af608e991569076671",
"shasum": ""
},
"require": {
"ext-pcre": "*",
"matthiasmullie/path-converter": "~1.1",
"php": ">=5.3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": ">=2.0",
"matthiasmullie/scrapbook": ">=1.3",
"phpunit/phpunit": ">=4.8"
},
"suggest": {
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
},
"bin": [
"bin/minifycss",
"bin/minifyjs"
],
"type": "library",
"autoload": {
"psr-4": {
"MatthiasMullie\\Minify\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matthias Mullie",
"email": "minify@mullie.eu",
"homepage": "https://www.mullie.eu",
"role": "Developer"
}
],
"description": "CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.",
"homepage": "https://github.com/matthiasmullie/minify",
"keywords": [
"JS",
"css",
"javascript",
"minifier",
"minify"
],
"support": {
"issues": "https://github.com/matthiasmullie/minify/issues",
"source": "https://github.com/matthiasmullie/minify/tree/1.3.75"
},
"funding": [
{
"url": "https://github.com/matthiasmullie",
"type": "github"
}
],
"time": "2025-06-25T09:56:19+00:00"
},
{
"name": "matthiasmullie/path-converter",
"version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/matthiasmullie/path-converter.git",
"reference": "e7d13b2c7e2f2268e1424aaed02085518afa02d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/e7d13b2c7e2f2268e1424aaed02085518afa02d9",
"reference": "e7d13b2c7e2f2268e1424aaed02085518afa02d9",
"shasum": ""
},
"require": {
"ext-pcre": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"type": "library",
"autoload": {
"psr-4": {
"MatthiasMullie\\PathConverter\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matthias Mullie",
"email": "pathconverter@mullie.eu",
"homepage": "http://www.mullie.eu",
"role": "Developer"
}
],
"description": "Relative path converter",
"homepage": "http://github.com/matthiasmullie/path-converter",
"keywords": [
"converter",
"path",
"paths",
"relative"
],
"support": {
"issues": "https://github.com/matthiasmullie/path-converter/issues",
"source": "https://github.com/matthiasmullie/path-converter/tree/1.1.3"
},
"time": "2019-02-05T23:41:09+00:00"
},
{
"name": "miljar/php-exif",
"version": "v0.6.5",
@@ -4228,6 +4105,123 @@
],
"time": "2025-09-26T15:07:38+00:00"
},
{
"name": "tedivm/jshrink",
"version": "v1.8.0",
"source": {
"type": "git",
"url": "https://github.com/tedious/JShrink.git",
"reference": "29ee510d684c22060040f4260a527206eb8199f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tedious/JShrink/zipball/29ee510d684c22060040f4260a527206eb8199f1",
"reference": "29ee510d684c22060040f4260a527206eb8199f1",
"shasum": ""
},
"require": {
"php": "^7.0|^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.14",
"php-coveralls/php-coveralls": "^2.5.0",
"phpunit/phpunit": "^9|^10"
},
"type": "library",
"autoload": {
"psr-0": {
"JShrink": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Robert Hafner",
"email": "tedivm@tedivm.com"
}
],
"description": "Javascript Minifier built in PHP",
"homepage": "http://github.com/tedious/JShrink",
"keywords": [
"javascript",
"minifier"
],
"support": {
"issues": "https://github.com/tedious/JShrink/issues",
"source": "https://github.com/tedious/JShrink/tree/v1.8.0"
},
"funding": [
{
"url": "https://github.com/tedivm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/tedivm/jshrink",
"type": "tidelift"
}
],
"time": "2025-07-28T17:09:23+00:00"
},
{
"name": "tubalmartin/cssmin",
"version": "v4.1.1",
"source": {
"type": "git",
"url": "https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port.git",
"reference": "3cbf557f4079d83a06f9c3ff9b957c022d7805cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tubalmartin/YUI-CSS-compressor-PHP-port/zipball/3cbf557f4079d83a06f9c3ff9b957c022d7805cf",
"reference": "3cbf557f4079d83a06f9c3ff9b957c022d7805cf",
"shasum": ""
},
"require": {
"ext-pcre": "*",
"php": ">=5.3.2"
},
"require-dev": {
"cogpowered/finediff": "0.3.*",
"phpunit/phpunit": "4.8.*"
},
"bin": [
"cssmin"
],
"type": "library",
"autoload": {
"psr-4": {
"tubalmartin\\CssMin\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Túbal Martín",
"homepage": "http://tubalmartin.me/"
}
],
"description": "A PHP port of the YUI CSS compressor",
"homepage": "https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port",
"keywords": [
"compress",
"compressor",
"css",
"cssmin",
"minify",
"yui"
],
"support": {
"issues": "https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port/issues",
"source": "https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port"
},
"time": "2018-01-15T15:26:51+00:00"
},
{
"name": "twig/twig",
"version": "3.x-dev",

View File

@@ -16,8 +16,8 @@ use Grav\Common\Grav;
use Grav\Common\Uri;
use Grav\Common\Utils;
use Grav\Framework\Object\PropertyObject;
use MatthiasMullie\Minify\CSS;
use MatthiasMullie\Minify\JS;
use tubalmartin\CssMin\Minifier as CSSMinifier;
use JShrink\Minifier as JSMinifier;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
use function array_key_exists;
@@ -144,9 +144,8 @@ class Pipeline extends PropertyObject
// Minify if required
if ($this->shouldMinify('css')) {
$minifier = new CSS();
$minifier->add($buffer);
$buffer = $minifier->minify();
$minifier = new CSSMinifier();
$buffer = $minifier->run($buffer);
}
// Write file
@@ -206,9 +205,7 @@ class Pipeline extends PropertyObject
// Minify if required
if ($this->shouldMinify('js')) {
$minifier = new JS();
$minifier->add($buffer);
$buffer = $minifier->minify();
$buffer = JSMinifier::minify($buffer);
}
// Write file