lionmm/compile-blades
最新稳定版本:1.0.1-rc1
Composer 安装命令:
composer require lionmm/compile-blades
包简介
Fork of te-cho/compile-blades to compile blades into a new file instead of overwriting the old file.
README 文档
README
A Laravel package for compiling blades nested in 1 file into 1 flattened file.
Refactored and tested only for Laravel 8
Be ready to refactor your views for using this command ;)
Why?
For best performance, you may want to consider flattening your blades on production, cause a lot of nesting consumes time in laravel since each nested level repeats the same pipline process, that consumes time & memory.
Example of problems:
- https://stackoverflow.com/questions/30673129/laravel-blades-performance/44863712#44863712
- https://laracasts.com/discuss/channels/laravel/how-to-improve-laravel-views-performance-when-using-multiple-times-same-view-file-or-howto-avoid-repeating-expensive-read-file-operation
Table of Contents
Requirements
This version of package working only with Laravel 8+
Installation
1) Require the package
From your project's base path, run:
$ composer require lionmm/compile-blades
2) Configure Laravel
$ ./artisan vendor:publish --provider="Lionmm\CompileBlades\CompileBladesServiceProvider"
WIP
Usage
Before getting started, I highly recommend reading through Laravels documentation on Views and Blades.
Flattening Views:
Providing everything is set up and configured properly, all you need to do in order to flatten a view for a certain route or something else, is running the following command:
$ php artisan view:compile view.name
This will generate a flattened view instead of the current one.
Better way: pic needed blades in auto_compilers section of configuration and use command
$ php artisan view:compile:auto
By default, folder compiled will be created in your resources/views path and flatten files will be placed in it
Now you can use command compiled_view(); instead of view(); for using flatten views IF they present
WIP
统计信息
- 总下载量: 171
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-25