blood72/blade-minify

Minify blade format for personal use

v1.4.1 2021-06-23 12:50 UTC

This package is auto-updated.

Last update: 2024-10-24 00:27:42 UTC


README

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.

Index

Requirement

  • PHP >= 7.1
  • mrclay/minify ^3.0

Installation

Install using the composer.

composer require blood72/blade-minify

Usage

  • 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'],
    ]);

Example

You can compare test files. see more examples.

Reference

License

This package is open-sourced software licensed under the MIT license.