Skip to content

AlliBalliBaba/Flatten-Laravel-Blade-Views

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

Flattening Laravel Blade Files

This is a simple script to speed up Laravel Blade templates with lots of @includes.

The idea is to remove the overhead from creating a new View by instead directly calling PHP's require(). This can significantly speed up big Blade templates, that are constructed from lots of different small pieces, for templates with 1000+ includes it can make rendering up to 4x faster.

Usage:

php php artisan view:flatten

To reset the flattened views, you can run:

php php artisan view:cache

Advantages:

  • more speed
  • variables behave like they would with normal @includes

Disadvantages:

  • Exceptions will not directly log the file and line number in the template where they were thrown
  • Views won't automatically recompile when the source file changes

About

This repository just represents an idea of how one could flatten @include in Laravel Blade views

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages