From 2b112875f5f5c994907a82ea6d746de597e23be1 Mon Sep 17 00:00:00 2001 From: Scott Bedard Date: Wed, 10 Aug 2022 22:59:35 -0500 Subject: [PATCH 1/4] 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 2/4] 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 3/4] 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 4/4] 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": {