Blade Minifier for personal use
Obviously this doesn't minify the .blade.php format itself.
This is specialized minification in the compiled .php by the Laravel Blade Compiler.
Install using the composer.
composer require blood72/blade-minify
simple run
use Blood72\Minify\Blade as BladeMinifier;
$minified = BladeMinifier::minify('<HTML string>');
with CSS, JavaScript Minifier (its installed by default with this package)
use Blood72\Minify\Blade as BladeMinifier;
use JSMin\JSMin as JSMinifier;
use Minify_CSSmin as CSSMinifier;
$minified = BladeMinifier::minify('<HTML string>', [
'cssMinifier' => [CSSMinifier::class, 'minify'],
'jsMinifier' => [JSMinifier::class, 'minify'],
]);
You can compare test files. see more examples.
This package is open-sourced software licensed under the MIT license.