Skip to content

Commit 09b9cb4

Browse files
committed
Fix #144 and tests for PHP 5.6 & 7.0.
1 parent 2b11287 commit 09b9cb4

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Install Composer dependencies
2929
env:
3030
PHP_VERSION: ${{ matrix.php-versions }}
31-
run: composer install --no-progress --prefer-dist --optimize-autoloader $(if [ "$PHP_VERSION" == "8.0" || "$PHP_VERSION" == "8.1" ]; then echo "--ignore-platform-reqs"; fi;)
31+
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;)
3232
- name: Run tests with code coverage
3333
env:
3434
PHP_VERSION: ${{ matrix.php-versions }}

src/Compilers/MinifyCompiler.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class MinifyCompiler extends BladeCompiler
4949
* @param string $cachePath
5050
* @param array $ignoredPaths
5151
* @param \Illuminate\View\Compilers\BladeCompiler $previousCompiler
52+
* @param array $customDirectives
5253
*
5354
* @return void
5455
*/
@@ -57,13 +58,20 @@ public function __construct(
5758
Filesystem $files,
5859
$cachePath,
5960
$ignoredPaths = [],
60-
$previousCompiler = null
61+
$previousCompiler = null,
62+
$customDirectives = []
6163
) {
6264
parent::__construct($files, $cachePath);
6365
$this->blade = $blade;
6466
$this->ignoredPaths = $ignoredPaths;
6567
$this->compilers[] = 'Minify';
6668
$this->previousCompiler = $previousCompiler;
69+
70+
if (count($customDirectives)) {
71+
foreach ($customDirectives as $key => $value) {
72+
$this->directive($key, $value);
73+
}
74+
}
6775
}
6876

6977
/**

src/HTMLMinServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ protected function registerMinifyCompiler()
184184
$storagePath = $app->config->get('view.compiled');
185185
$ignoredPaths = $app->config->get('htmlmin.ignore', []);
186186

187-
return new MinifyCompiler($blade, $files, $storagePath, $ignoredPaths, $this->previousCompiler);
187+
return new MinifyCompiler($blade, $files, $storagePath, $ignoredPaths, $this->previousCompiler, $this->previousCompiler->getCustomDirectives());
188188
});
189189

190190
$this->app->alias('htmlmin.compiler', MinifyCompiler::class);

0 commit comments

Comments
 (0)