astroshippers / laravel-minified-blade
此包提供 `.min.blade.php` 文件扩展名
v1.0.1
2022-06-16 00:53 UTC
Requires
- php: ^8.0.2
- illuminate/support: ^9.17
- illuminate/view: ^9.17
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
This package is not auto-updated.
Last update: 2024-09-20 10:03:46 UTC
README
Laravel Minified Blade
此包提供 .min.blade.php
文件扩展名。
只需将 .min
添加到您的 .blade.php
文件中,模板就会被压缩!⚡
安装
composer require astroshippers/laravel-minified-blade
用法
让我们用这个文件作为一个例子。
<div> @if($age > 13) <p> Welcome to your new account! </p> @else <b> Sorry, access denied. </b> @endif </div>
通常情况下,不使用此包时,它将被编译成这样
<div> <?php if($age > 13): ?> <p> Welcome to your new account! </p> <?php else: ?> <b> Sorry, access denied. </b> <?php endif; ?> </div> <?php /**PATH /home/asdf/code/notionmailer/resources/views/test.blade.php ENDPATH**/ ?>
但是,如果您添加此包并在文件扩展名中使用 .min
,您将得到以下结果
<div><?php if($age> 13): ?><p> Welcome to your new account! </p><?php else: ?><b> Sorry, access denied. </b><?php endif; ?></div><?php /**PATH /home/asdf/code/notionmailer/resources/views/test.min.blade.php ENDPATH**/ ?>
有什么用例?
为什么不直接使用指令,如 @minified
和 @endminified
?
指令在模板渲染后执行,可能会添加不希望的行为,例如动态内容间距被压缩。