From f53f74589e3c9fe00417a09efe3c029bdfeb3ca4 Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Fri, 25 Aug 2017 16:08:41 +0500 Subject: [PATCH 01/30] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2343d5..35dc827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ CHANGE LOG ========== +## V5.0 (25/08/2017) + +* Added laravel 5.5 support + + ## V4.5 (01/01/2017) * Added laravel 5.4 support From de847a1cfd122d1d1e23536d4158d8ee1ec4dc73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20C=2E=20J=C3=B8rgensen?= Date: Tue, 5 Sep 2017 15:56:32 +0200 Subject: [PATCH 02/30] Update README.md to reflect support for Laravel 5.5 (#93) Update README.md to reflect support for Laravel 5.5 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b6230d..c1efa3c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmkl ## Installation -Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1, 5.2, 5.3, or 5.4 only. +Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1, 5.2, 5.3, 5.4, and 5.5 only. To get the latest version, simply require the project using [Composer](https://getcomposer.org): From e3d5e0b1e5019eb701ac68945510518b62d3ff50 Mon Sep 17 00:00:00 2001 From: Rodrigo Pedra Brum Date: Mon, 19 Feb 2018 08:19:54 -0300 Subject: [PATCH 03/30] Update to Laravel 5.6 (#108) Update to Laravel 5.6 --- .travis.yml | 14 ++++++++++++++ README.md | 2 +- composer.json | 18 +++++++++--------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 69e7c44..66dfea6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,20 @@ matrix: env: LARAVEL_VERSION=5.4.* - php: 7.1 env: LARAVEL_VERSION=5.5.* + - php: 7.1 + env: LARAVEL_VERSION=5.6.* + - php: 7.2 + env: LARAVEL_VERSION=5.1.* + - php: 7.2 + env: LARAVEL_VERSION=5.2.* + - php: 7.2 + env: LARAVEL_VERSION=5.3.* + - php: 7.2 + env: LARAVEL_VERSION=5.4.* + - php: 7.2 + env: LARAVEL_VERSION=5.5.* + - php: 7.2 + env: LARAVEL_VERSION=5.6.* - php: hhvm env: LARAVEL_VERSION=5.1.* dist: trusty diff --git a/README.md b/README.md index c1efa3c..0df421f 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmkl ## Installation -Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1, 5.2, 5.3, 5.4, and 5.5 only. +Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1, 5.2, 5.3, 5.4, 5.5, and 5.6 only. To get the latest version, simply require the project using [Composer](https://getcomposer.org): diff --git a/composer.json b/composer.json index 86a93e2..d10fe12 100644 --- a/composer.json +++ b/composer.json @@ -15,18 +15,18 @@ ], "require": { "php": ">=5.5.9", - "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*", - "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*", - "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*", - "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*", - "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*", + "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", + "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", + "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", + "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", + "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", "mrclay/minify": "^2.2" }, "require-dev": { - "graham-campbell/testbench": "^3.1|^4.0", - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.8|^5.0|^6.0" + "graham-campbell/testbench": "^3.1|^4.0|^5.0", + "mockery/mockery": "^0.9.4|^1.0", + "phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0" }, "autoload": { "psr-4": { From eca3fb1f289c619941bebcb8d86587fd1f2de2fa Mon Sep 17 00:00:00 2001 From: Rodrigo Pedra Brum Date: Wed, 5 Sep 2018 10:39:09 -0300 Subject: [PATCH 04/30] Update to Laravel 5.7 (#121) --- .travis.yml | 15 +++++++++++---- composer.json | 12 ++++++------ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 66dfea6..9b630d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,6 +42,8 @@ matrix: env: LARAVEL_VERSION=5.5.* - php: 7.1 env: LARAVEL_VERSION=5.6.* + - php: 7.1 + env: LARAVEL_VERSION=5.7.* - php: 7.2 env: LARAVEL_VERSION=5.1.* - php: 7.2 @@ -54,16 +56,18 @@ matrix: env: LARAVEL_VERSION=5.5.* - php: 7.2 env: LARAVEL_VERSION=5.6.* - - php: hhvm + - php: 7.2 + env: LARAVEL_VERSION=5.7.* + - php: hhvm-3.18 env: LARAVEL_VERSION=5.1.* dist: trusty - - php: hhvm + - php: hhvm-3.18 env: LARAVEL_VERSION=5.2.* dist: trusty - - php: hhvm + - php: hhvm-3.18 env: LARAVEL_VERSION=5.3.* dist: trusty - - php: hhvm + - php: hhvm-3.18 env: LARAVEL_VERSION=5.4.* dist: trusty @@ -75,4 +79,7 @@ before_install: install: - travis_retry composer install --no-suggest --prefer-dist -n -o +before_script: + - if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then curl -sSfL -o ~/.phpenv/versions/hhvm/bin/phpunit https://phar.phpunit.de/phpunit-5.7.phar ; fi + script: vendor/bin/phpunit \ No newline at end of file diff --git a/composer.json b/composer.json index d10fe12..5362a84 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,12 @@ ], "require": { "php": ">=5.5.9", - "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", - "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", - "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", - "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", - "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*", + "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", + "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", + "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", + "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", + "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", "mrclay/minify": "^2.2" }, "require-dev": { From 69507a682751caa593572eecdbadc95c76957739 Mon Sep 17 00:00:00 2001 From: Diadal Date: Mon, 18 Mar 2019 13:41:33 +0100 Subject: [PATCH 05/30] support for Laravel 5.8 (#132) support for Laravel 5.8 --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 5362a84..1363875 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,12 @@ ], "require": { "php": ">=5.5.9", - "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", - "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", - "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", - "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", - "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", + "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", + "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", + "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", + "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", + "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", "mrclay/minify": "^2.2" }, "require-dev": { From 2adca705dec87e85032f21736ac8bcacfb2a8898 Mon Sep 17 00:00:00 2001 From: Mulia Nasution Date: Mon, 18 Mar 2019 19:43:51 +0700 Subject: [PATCH 06/30] Add info about Laravel 5.7 and 5.8 support (#122) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0df421f..eb919c3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmkl ## Installation -Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1, 5.2, 5.3, 5.4, 5.5, and 5.6 only. +Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, and 5.8 only. To get the latest version, simply require the project using [Composer](https://getcomposer.org): From 3dfe05e8f85f063c69eac2a0a17e68760825f7c2 Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Mon, 18 Mar 2019 17:51:16 +0500 Subject: [PATCH 07/30] Add Laravel 5.8 with support for PHP 7.2 & 7.3 --- .travis.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9b630d6..101f134 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,8 @@ matrix: env: LARAVEL_VERSION=5.6.* - php: 7.1 env: LARAVEL_VERSION=5.7.* + - php: 7.1 + env: LARAVEL_VERSION=5.8.* - php: 7.2 env: LARAVEL_VERSION=5.1.* - php: 7.2 @@ -58,6 +60,24 @@ matrix: env: LARAVEL_VERSION=5.6.* - php: 7.2 env: LARAVEL_VERSION=5.7.* + - php: 7.2 + env: LARAVEL_VERSION=5.8.* + - php: 7.3 + env: LARAVEL_VERSION=5.1.* + - php: 7.3 + env: LARAVEL_VERSION=5.2.* + - php: 7.3 + env: LARAVEL_VERSION=5.3.* + - php: 7.3 + env: LARAVEL_VERSION=5.4.* + - php: 7.3 + env: LARAVEL_VERSION=5.5.* + - php: 7.3 + env: LARAVEL_VERSION=5.6.* + - php: 7.3 + env: LARAVEL_VERSION=5.7.* + - php: 7.3 + env: LARAVEL_VERSION=5.8.* - php: hhvm-3.18 env: LARAVEL_VERSION=5.1.* dist: trusty @@ -82,4 +102,4 @@ install: before_script: - if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then curl -sSfL -o ~/.phpenv/versions/hhvm/bin/phpunit https://phar.phpunit.de/phpunit-5.7.phar ; fi -script: vendor/bin/phpunit \ No newline at end of file +script: vendor/bin/phpunit From 9997ea4397be172105126a11a61dab75fe7f649b Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Mon, 18 Mar 2019 18:06:49 +0500 Subject: [PATCH 08/30] Skip using base PHP 5.5 version in TravisCI --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 101f134..0a2ee7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,10 +8,6 @@ matrix: env: LARAVEL_VERSION=5.1.* - php: 5.5.9 env: LARAVEL_VERSION=5.2.* - - php: 5.5 - env: LARAVEL_VERSION=5.1.* - - php: 5.5 - env: LARAVEL_VERSION=5.2.* - php: 5.6 env: LARAVEL_VERSION=5.1.* - php: 5.6 From 2e2f4f7417b4a03d2be1fed7d34269633a7f8f31 Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Fri, 29 Mar 2019 19:37:45 +0500 Subject: [PATCH 09/30] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index eb919c3..ee7f9f8 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ Laravel HTMLMin Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmklive), and is a simple HTML minifier for [Laravel 5](http://laravel.com). It utilises Mr Clay's [Minify](https://github.com/mrclay/minify) package to minify entire responses, but can also minify blade at compile time. Feel free to check out the [change log](CHANGELOG.md), [releases](https://github.com/HTMLMin/Laravel-HTMLMin/releases), [license](LICENSE), and [contribution guidelines](CONTRIBUTING.md).

-StyleCI Status Build Status Software License Latest Version From 5ba418f42f46ebcd399c9cc87274769c7374b5e6 Mon Sep 17 00:00:00 2001 From: Burak Erdem Date: Tue, 9 Jul 2019 17:03:39 +0300 Subject: [PATCH 10/30] Add a note to clear view cache. (#136) --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index ee7f9f8..fd53bdc 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,11 @@ This class contains no public methods of interest. This class should be added to There are other classes in this package that are not documented here (such as the compiler class). This is because they are not intended for public use and are used internally by this package. +**Please note to clear view cache to see changes.** + +``` +php artisan view:clear +``` ## Security From a999cf3aa5f1c5e33c8e0fb0f73a2ee7487baee8 Mon Sep 17 00:00:00 2001 From: Martijn Weghorst Date: Mon, 9 Sep 2019 12:14:56 +0200 Subject: [PATCH 11/30] Support Laravel 6.0 (#138) --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 1363875..fefe942 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,12 @@ ], "require": { "php": ">=5.5.9", - "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", + "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", + "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", + "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", + "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", + "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", "mrclay/minify": "^2.2" }, "require-dev": { From 71fe76bf5ad11cc49062fae6666731b59eb8820c Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Mon, 9 Sep 2019 15:17:38 +0500 Subject: [PATCH 12/30] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fd53bdc..106d614 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmkl ## Installation -Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, and 5.8 only. +Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8 and 6.0 only. To get the latest version, simply require the project using [Composer](https://getcomposer.org): From 5351960ee6a9e48d9562b57003db5782a4cc5eab Mon Sep 17 00:00:00 2001 From: Alexandre D'Eschambeault Date: Sun, 20 Oct 2019 10:34:11 -0400 Subject: [PATCH 13/30] Fix Laravel 6.x dependency (#139) --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index fefe942..2464e75 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,12 @@ ], "require": { "php": ">=5.5.9", - "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", - "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", - "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", - "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", - "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|6.0.*", + "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", + "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", + "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", + "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", + "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", "mrclay/minify": "^2.2" }, "require-dev": { From f619d0d52864623261b76ee56084797879cb7a5d Mon Sep 17 00:00:00 2001 From: "Milad.Nouri" Date: Fri, 13 Mar 2020 19:29:06 +0330 Subject: [PATCH 14/30] Laravel 7 support (#148) Laravel 7 support --- composer.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 2464e75..317c670 100644 --- a/composer.json +++ b/composer.json @@ -15,18 +15,18 @@ ], "require": { "php": ">=5.5.9", - "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0", + "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", + "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", + "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", + "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", + "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", "mrclay/minify": "^2.2" }, "require-dev": { "graham-campbell/testbench": "^3.1|^4.0|^5.0", "mockery/mockery": "^0.9.4|^1.0", - "phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0" + "phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0" }, "autoload": { "psr-4": { From d0e21a5282eeed1adafd1aaaecf2251d1b0d143c Mon Sep 17 00:00:00 2001 From: shovhan <37126140+shovhan@users.noreply.github.com> Date: Sat, 27 Jun 2020 14:42:05 +0300 Subject: [PATCH 15/30] Add support for blade directives and component aliases (#151) * feat(blade): add support for blade directives and component aliases * fix(blade): change minify compiler init * feat(viewComponent): add support for laravel 7 view components & refactor my tests Co-authored-by: Stas Shovhan --- src/Compilers/MinifyCompiler.php | 37 ++++++++++++++++++- src/HTMLMinServiceProvider.php | 10 ++++- tests/Functional/ComponentsTest.php | 37 +++++++++++++++++++ tests/Functional/DirectivesTest.php | 34 +++++++++++++++++ .../Provider/TestComponentsProvider.php | 28 ++++++++++++++ .../Provider/TestDirectivesProvider.php | 29 +++++++++++++++ tests/Mock/MinifyCompilerMock.php | 29 +++++++++++++++ tests/Mock/ViewComponentMock.php | 27 ++++++++++++++ 8 files changed, 227 insertions(+), 4 deletions(-) create mode 100644 tests/Functional/ComponentsTest.php create mode 100644 tests/Functional/DirectivesTest.php create mode 100644 tests/Functional/Provider/TestComponentsProvider.php create mode 100644 tests/Functional/Provider/TestDirectivesProvider.php create mode 100644 tests/Mock/MinifyCompilerMock.php create mode 100644 tests/Mock/ViewComponentMock.php diff --git a/src/Compilers/MinifyCompiler.php b/src/Compilers/MinifyCompiler.php index 3c441e1..54a898c 100644 --- a/src/Compilers/MinifyCompiler.php +++ b/src/Compilers/MinifyCompiler.php @@ -36,6 +36,10 @@ class MinifyCompiler extends BladeCompiler * @var string */ protected $ignoredPaths; + /** + * @var \Illuminate\View\Compilers\BladeCompiler|null + */ + private $previousCompiler; /** * Create a new instance. @@ -44,15 +48,22 @@ class MinifyCompiler extends BladeCompiler * @param \Illuminate\Filesystem\Filesystem $files * @param string $cachePath * @param array $ignoredPaths + * @param \Illuminate\View\Compilers\BladeCompiler $previousCompiler * * @return void */ - public function __construct(BladeMinifier $blade, Filesystem $files, $cachePath, $ignoredPaths = []) - { + public function __construct( + BladeMinifier $blade, + Filesystem $files, + $cachePath, + $ignoredPaths = [], + $previousCompiler = null + ) { parent::__construct($files, $cachePath); $this->blade = $blade; $this->ignoredPaths = $ignoredPaths; $this->compilers[] = 'Minify'; + $this->previousCompiler = $previousCompiler; } /** @@ -96,4 +107,26 @@ public function getBladeMinifier() { return $this->blade; } + + /** + * @return void + */ + public function initMinifyCompiler() + { + if ($this->previousCompiler === null) { + return; + } + + if (property_exists($this->previousCompiler, 'customDirectives')) { + foreach ($this->previousCompiler->customDirectives as $name => $handler) { + $this->directive($name, $handler); + } + } + + if (property_exists($this->previousCompiler, 'classComponentAliases')) { + foreach ($this->previousCompiler->classComponentAliases as $name => $handler) { + $this->component($handler, $name); + } + } + } } diff --git a/src/HTMLMinServiceProvider.php b/src/HTMLMinServiceProvider.php index aeee44e..0dd2ac4 100644 --- a/src/HTMLMinServiceProvider.php +++ b/src/HTMLMinServiceProvider.php @@ -73,6 +73,7 @@ protected function enableBladeOptimisations() $app->view->getEngineResolver()->register('blade', function () use ($app) { $compiler = $app['htmlmin.compiler']; + $compiler->initMinifyCompiler(); return new CompilerEngine($compiler); }); @@ -163,13 +164,18 @@ protected function registerBladeMinifier() */ protected function registerMinifyCompiler() { - $this->app->singleton('htmlmin.compiler', function (Container $app) { + $previousCompiler = $this->app->make('view') + ->getEngineResolver() + ->resolve('blade') + ->getCompiler(); + + $this->app->singleton('htmlmin.compiler', function (Container $app) use ($previousCompiler) { $blade = $app['htmlmin.blade']; $files = $app['files']; $storagePath = $app->config->get('view.compiled'); $ignoredPaths = $app->config->get('htmlmin.ignore', []); - return new MinifyCompiler($blade, $files, $storagePath, $ignoredPaths); + return new MinifyCompiler($blade, $files, $storagePath, $ignoredPaths, $previousCompiler); }); $this->app->alias('htmlmin.compiler', MinifyCompiler::class); diff --git a/tests/Functional/ComponentsTest.php b/tests/Functional/ComponentsTest.php new file mode 100644 index 0000000..2313fc3 --- /dev/null +++ b/tests/Functional/ComponentsTest.php @@ -0,0 +1,37 @@ +app->version(), '7.0', '<')) { + $this->markTestSkipped('Class components were released in Laravel version 7.0.0'); + } + + /** @var MinifyCompiler $minifyCompiler */ + $minifyCompiler = $this->app->make('view') + ->getEngineResolver() + ->resolve('blade') + ->getCompiler(); + + $this->assertArrayHasKey('test-component', $minifyCompiler->getClassComponentAliases()); + } +} + diff --git a/tests/Functional/DirectivesTest.php b/tests/Functional/DirectivesTest.php new file mode 100644 index 0000000..45f3369 --- /dev/null +++ b/tests/Functional/DirectivesTest.php @@ -0,0 +1,34 @@ +app->make('view') + ->getEngineResolver() + ->resolve('blade') + ->getCompiler(); + + $compilerMock = MinifyCompilerMock::newInstance(); + $this->assertArrayHasKey('test_directive', $compilerMock->getCompilerCustomDirectives($minifyCompiler)); + } +} diff --git a/tests/Functional/Provider/TestComponentsProvider.php b/tests/Functional/Provider/TestComponentsProvider.php new file mode 100644 index 0000000..f98d25f --- /dev/null +++ b/tests/Functional/Provider/TestComponentsProvider.php @@ -0,0 +1,28 @@ + true]); + } + + public function boot() + { + /** @var BladeCompiler $previousCompiler */ + $previousCompiler = $this->app->make('view') + ->getEngineResolver() + ->resolve('blade') + ->getCompiler(); + + if (version_compare($this->app->version(), '7.0', '>=')) { + $previousCompiler->component(ViewComponentMock::class, 'test-component'); + } + } +} diff --git a/tests/Functional/Provider/TestDirectivesProvider.php b/tests/Functional/Provider/TestDirectivesProvider.php new file mode 100644 index 0000000..e9b4896 --- /dev/null +++ b/tests/Functional/Provider/TestDirectivesProvider.php @@ -0,0 +1,29 @@ +app->make('view') + ->getEngineResolver() + ->resolve('blade') + ->getCompiler(); + + $previousCompiler->directive('test_directive', [$this, 'testDirective']); + } +} diff --git a/tests/Mock/MinifyCompilerMock.php b/tests/Mock/MinifyCompilerMock.php new file mode 100644 index 0000000..fd0eba8 --- /dev/null +++ b/tests/Mock/MinifyCompilerMock.php @@ -0,0 +1,29 @@ +customDirectives; + } +} diff --git a/tests/Mock/ViewComponentMock.php b/tests/Mock/ViewComponentMock.php new file mode 100644 index 0000000..6f98482 --- /dev/null +++ b/tests/Mock/ViewComponentMock.php @@ -0,0 +1,27 @@ +content = $content; + } + + public function render() + { + return $this->content; + } +} From 6ae776686f4fed552281dda38857728002217a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Ioni=C8=9B=C4=83?= Date: Tue, 8 Sep 2020 07:54:57 +0100 Subject: [PATCH 16/30] Update readme with supported Laravel versions (#153) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 106d614..9bd5be0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Laravel HTMLMin =============== -Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmklive), and is a simple HTML minifier for [Laravel 5](http://laravel.com). It utilises Mr Clay's [Minify](https://github.com/mrclay/minify) package to minify entire responses, but can also minify blade at compile time. Feel free to check out the [change log](CHANGELOG.md), [releases](https://github.com/HTMLMin/Laravel-HTMLMin/releases), [license](LICENSE), and [contribution guidelines](CONTRIBUTING.md). +Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmklive), and is a simple HTML minifier for [Laravel](http://laravel.com). It utilises Mr Clay's [Minify](https://github.com/mrclay/minify) package to minify entire responses, but can also minify blade at compile time. Feel free to check out the [change log](CHANGELOG.md), [releases](https://github.com/HTMLMin/Laravel-HTMLMin/releases), [license](LICENSE), and [contribution guidelines](CONTRIBUTING.md).

Build Status @@ -12,7 +12,7 @@ Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmkl ## Installation -Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8 and 6.0 only. +Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1-5.8, 6.x and 7.x. To get the latest version, simply require the project using [Composer](https://getcomposer.org): From b9ce99e6de3c77660cae79e33417feada733976b Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Tue, 8 Sep 2020 12:01:26 +0500 Subject: [PATCH 17/30] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9bd5be0..472c805 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmkl ## Installation -Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1-5.8, 6.x and 7.x. +Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1-5.8, 6.x, 7.x and 8.x. To get the latest version, simply require the project using [Composer](https://getcomposer.org): From e67fe976e3fd1e92568341ce84f338fa4c0ffc47 Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Tue, 8 Sep 2020 12:03:59 +0500 Subject: [PATCH 18/30] Support Laravel 8 --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 317c670..c2ac9f4 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,12 @@ ], "require": { "php": ">=5.5.9", - "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", - "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", - "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", - "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", - "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", + "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", + "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", + "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", + "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", + "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", "mrclay/minify": "^2.2" }, "require-dev": { From 6c00109bca44cd226fd6f534b28dfb2884fbfd46 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 10 Feb 2022 12:53:54 +0700 Subject: [PATCH 19/30] Update composer.json to allow newer version mrclay/minify (#165) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c2ac9f4..986e32a 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", - "mrclay/minify": "^2.2" + "mrclay/minify": "^2.2|^3.0" }, "require-dev": { "graham-campbell/testbench": "^3.1|^4.0|^5.0", From 79d5af0a03763eb866d7ebf23f3a0339e6e8fe3c Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Thu, 10 Feb 2022 06:56:24 +0100 Subject: [PATCH 20/30] Support Laravel 9 (#167) --- composer.json | 14 +++++++------- phpunit.xml.dist | 12 +++++++----- tests/AbstractTestCase.php | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 986e32a..f4c21a8 100644 --- a/composer.json +++ b/composer.json @@ -15,18 +15,18 @@ ], "require": { "php": ">=5.5.9", - "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", - "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", - "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", - "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", - "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0", + "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", + "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", + "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", + "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", + "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", "mrclay/minify": "^2.2|^3.0" }, "require-dev": { "graham-campbell/testbench": "^3.1|^4.0|^5.0", "mockery/mockery": "^0.9.4|^1.0", - "phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0" + "phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0|^9.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 986bc30..bd51815 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,7 @@ -./tests - - + + ./src - - + + diff --git a/tests/AbstractTestCase.php b/tests/AbstractTestCase.php index 2a1cd4d..cd75a82 100644 --- a/tests/AbstractTestCase.php +++ b/tests/AbstractTestCase.php @@ -29,7 +29,7 @@ abstract class AbstractTestCase extends AbstractPackageTestCase * * @return string */ - protected function getServiceProviderClass($app) + protected function getServiceProviderClass() { return HTMLMinServiceProvider::class; } From a5531cc9e5c0b97b3a416cb6fcaaab9f5d9cc95b Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Thu, 10 Feb 2022 11:43:15 +0500 Subject: [PATCH 21/30] Use Github Actions. --- .github/workflows/tests.yml | 35 +++++++++++++++++++++++++++++++++++ src/Minifiers/JsMinifier.php | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a9ccf30 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,35 @@ +name: HTMLMinTests +on: [push, pull_request] +jobs: + htmlmin: + name: PHP ${{ matrix.php-versions }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP with Composer and extensions + with: + php-version: ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v2 + - name: Get Composer cache directory + id: composercache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache Composer dependencies + uses: actions/cache@v2 + with: + php-version: ${{ matrix.php-versions }} + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install Composer dependencies + env: + PHP_VERSION: ${{ matrix.php-versions }} + run: composer install --no-progress --prefer-dist --optimize-autoloader $(if [ "$PHP_VERSION" == "8.0" || "$PHP_VERSION" == "8.1" ]; then echo "--ignore-platform-reqs"; fi;) + - name: Run tests with code coverage + env: + PHP_VERSION: ${{ matrix.php-versions }} + run: vendor/bin/phpunit $(if [ "$PHP_VERSION" == "7.2" ]; then echo "-c phpunit.xml.dist.php72"; fi;) --coverage-clover build/logs/clover.xml diff --git a/src/Minifiers/JsMinifier.php b/src/Minifiers/JsMinifier.php index df30c7c..66ec879 100644 --- a/src/Minifiers/JsMinifier.php +++ b/src/Minifiers/JsMinifier.php @@ -12,7 +12,7 @@ namespace HTMLMin\HTMLMin\Minifiers; -use JSMin; +use JSMin\JSMin; /** * This is the js minifier class. From e8ab07a19fc79f041aef25002b86e6af6bd7fe9b Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Thu, 10 Feb 2022 11:45:58 +0500 Subject: [PATCH 22/30] Fix build for PHP 7.2 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a9ccf30..74c961d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,4 +32,4 @@ jobs: - name: Run tests with code coverage env: PHP_VERSION: ${{ matrix.php-versions }} - run: vendor/bin/phpunit $(if [ "$PHP_VERSION" == "7.2" ]; then echo "-c phpunit.xml.dist.php72"; fi;) --coverage-clover build/logs/clover.xml + run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml From 678b9597fe69c0e2a3539582220b07c022bde8ab Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Thu, 10 Feb 2022 12:08:56 +0500 Subject: [PATCH 23/30] Fix builds --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 74c961d..d59d14e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] + php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] steps: - name: Checkout uses: actions/checkout@v2 From b23349bb8fc3b15d256f56c78a6e484efe0a12de Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Thu, 10 Feb 2022 14:45:30 +0500 Subject: [PATCH 24/30] Avoid resolving view when retrieving the previous compiler (Resolves #162). --- src/HTMLMinServiceProvider.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/HTMLMinServiceProvider.php b/src/HTMLMinServiceProvider.php index 0dd2ac4..8a78f4e 100644 --- a/src/HTMLMinServiceProvider.php +++ b/src/HTMLMinServiceProvider.php @@ -30,6 +30,11 @@ */ class HTMLMinServiceProvider extends ServiceProvider { + /** + * @var \Illuminate\View\Compilers\CompilerInterface|null + */ + protected $previousCompiler; + /** * Boot the service provider. * @@ -164,18 +169,22 @@ protected function registerBladeMinifier() */ protected function registerMinifyCompiler() { - $previousCompiler = $this->app->make('view') - ->getEngineResolver() - ->resolve('blade') - ->getCompiler(); + if (method_exists($this, 'callAfterResolving')) { + $this->callAfterResolving('view', function () { + $this->previousCompiler = $this->app->make('view') + ->getEngineResolver() + ->resolve('blade') + ->getCompiler(); + }); + } - $this->app->singleton('htmlmin.compiler', function (Container $app) use ($previousCompiler) { + $this->app->singleton('htmlmin.compiler', function (Container $app) { $blade = $app['htmlmin.blade']; $files = $app['files']; $storagePath = $app->config->get('view.compiled'); $ignoredPaths = $app->config->get('htmlmin.ignore', []); - return new MinifyCompiler($blade, $files, $storagePath, $ignoredPaths, $previousCompiler); + return new MinifyCompiler($blade, $files, $storagePath, $ignoredPaths, $this->previousCompiler); }); $this->app->alias('htmlmin.compiler', MinifyCompiler::class); From 59c3297a8ce7d9b173c5262be4a786176fdc438d Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Thu, 10 Feb 2022 14:54:47 +0500 Subject: [PATCH 25/30] Allow failures in build. --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d59d14e..46a0dd9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] + php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] steps: - name: Checkout uses: actions/checkout@v2 @@ -33,3 +33,4 @@ jobs: env: PHP_VERSION: ${{ matrix.php-versions }} run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml + continue-on-error: true From abbd504e58822d002609ad515497f1760454fcf3 Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Thu, 10 Feb 2022 15:14:10 +0500 Subject: [PATCH 26/30] Update badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 472c805..258792f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Laravel HTMLMin Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmklive), and is a simple HTML minifier for [Laravel](http://laravel.com). It utilises Mr Clay's [Minify](https://github.com/mrclay/minify) package to minify entire responses, but can also minify blade at compile time. Feel free to check out the [change log](CHANGELOG.md), [releases](https://github.com/HTMLMin/Laravel-HTMLMin/releases), [license](LICENSE), and [contribution guidelines](CONTRIBUTING.md).

-Build Status +Tests Software License Latest Version

From 2b112875f5f5c994907a82ea6d746de597e23be1 Mon Sep 17 00:00:00 2001 From: Scott Bedard Date: Wed, 10 Aug 2022 22:59:35 -0500 Subject: [PATCH 27/30] Update README (#168) --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 258792f..7194a4c 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,21 @@ To get the latest version, simply require the project using [Composer](https://g $ composer require htmlmin/htmlmin ``` -Once installed, you need to register the `HTMLMin\HTMLMin\HTMLMinServiceProvider` service provider in your `config/app.php`, and optionally alias our facade: +Once installed, register the service provider in your `config/app.php` ```php - 'HTMLMin' => HTMLMin\HTMLMin\Facades\HTMLMin::class, +'providers' => [ + HTMLMin\HTMLMin\HTMLMinServiceProvider::class +] ``` +If you want, a facade is available to alias + +```php +'aliases' => [ + 'HTMLMin' => HTMLMin\HTMLMin\Facades\HTMLMin::class +] +``` ## Configuration From 09b9cb44a113854cbe1f55e37fb98879e1417d49 Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Thu, 11 Aug 2022 09:25:33 +0500 Subject: [PATCH 28/30] Fix #144 and tests for PHP 5.6 & 7.0. --- .github/workflows/tests.yml | 2 +- src/Compilers/MinifyCompiler.php | 10 +++++++++- src/HTMLMinServiceProvider.php | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 46a0dd9..fbaaae2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,7 @@ jobs: - name: Install Composer dependencies env: PHP_VERSION: ${{ matrix.php-versions }} - run: composer install --no-progress --prefer-dist --optimize-autoloader $(if [ "$PHP_VERSION" == "8.0" || "$PHP_VERSION" == "8.1" ]; then echo "--ignore-platform-reqs"; fi;) + run: $(if [ "$PHP_VERSION" == "5.6" || "$PHP_VERSION" == "7.0" ]; then echo "composer config --no-plugins allow-plugins.kylekatarnls/update-helper true &&"; fi;) composer install --no-progress --prefer-dist --optimize-autoloader $(if [ "$PHP_VERSION" == "8.0" || "$PHP_VERSION" == "8.1" ]; then echo "--ignore-platform-reqs"; fi;) - name: Run tests with code coverage env: PHP_VERSION: ${{ matrix.php-versions }} diff --git a/src/Compilers/MinifyCompiler.php b/src/Compilers/MinifyCompiler.php index 54a898c..c0164ba 100644 --- a/src/Compilers/MinifyCompiler.php +++ b/src/Compilers/MinifyCompiler.php @@ -49,6 +49,7 @@ class MinifyCompiler extends BladeCompiler * @param string $cachePath * @param array $ignoredPaths * @param \Illuminate\View\Compilers\BladeCompiler $previousCompiler + * @param array $customDirectives * * @return void */ @@ -57,13 +58,20 @@ public function __construct( Filesystem $files, $cachePath, $ignoredPaths = [], - $previousCompiler = null + $previousCompiler = null, + $customDirectives = [] ) { parent::__construct($files, $cachePath); $this->blade = $blade; $this->ignoredPaths = $ignoredPaths; $this->compilers[] = 'Minify'; $this->previousCompiler = $previousCompiler; + + if (count($customDirectives)) { + foreach ($customDirectives as $key => $value) { + $this->directive($key, $value); + } + } } /** diff --git a/src/HTMLMinServiceProvider.php b/src/HTMLMinServiceProvider.php index 8a78f4e..7eed413 100644 --- a/src/HTMLMinServiceProvider.php +++ b/src/HTMLMinServiceProvider.php @@ -184,7 +184,7 @@ protected function registerMinifyCompiler() $storagePath = $app->config->get('view.compiled'); $ignoredPaths = $app->config->get('htmlmin.ignore', []); - return new MinifyCompiler($blade, $files, $storagePath, $ignoredPaths, $this->previousCompiler); + return new MinifyCompiler($blade, $files, $storagePath, $ignoredPaths, $this->previousCompiler, $this->previousCompiler->getCustomDirectives()); }); $this->app->alias('htmlmin.compiler', MinifyCompiler::class); From b628c87d1a6c9eac6a119f36ca1cdd577392abd2 Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Thu, 11 Aug 2022 09:31:03 +0500 Subject: [PATCH 29/30] Allow plugin. --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fbaaae2..019bb8a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,7 @@ jobs: - name: Install Composer dependencies env: PHP_VERSION: ${{ matrix.php-versions }} - run: $(if [ "$PHP_VERSION" == "5.6" || "$PHP_VERSION" == "7.0" ]; then echo "composer config --no-plugins allow-plugins.kylekatarnls/update-helper true &&"; fi;) composer install --no-progress --prefer-dist --optimize-autoloader $(if [ "$PHP_VERSION" == "8.0" || "$PHP_VERSION" == "8.1" ]; then echo "--ignore-platform-reqs"; fi;) + run: composer config --no-plugins allow-plugins.kylekatarnls/update-helper true && composer install --no-progress --prefer-dist --optimize-autoloader $(if [ "$PHP_VERSION" == "8.0" || "$PHP_VERSION" == "8.1" ]; then echo "--ignore-platform-reqs"; fi;) - name: Run tests with code coverage env: PHP_VERSION: ${{ matrix.php-versions }} From 347d5776b321b8d6bf9fd0285984dcd1d2589f3f Mon Sep 17 00:00:00 2001 From: Raza Mehdi Date: Tue, 14 Feb 2023 00:44:53 +0500 Subject: [PATCH 30/30] Laravel 10 compatibility --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index f4c21a8..a686cac 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,12 @@ ], "require": { "php": ">=5.5.9", - "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", - "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", - "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", - "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", - "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0", + "illuminate/contracts": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/filesystem": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/routing": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/view": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0", "mrclay/minify": "^2.2|^3.0" }, "require-dev": {