What is the current behavior?
Blade templates are compiled during first view.
What is the expected or desired behavior?
An option to turn off Blade compilation and a Composer script (or something) to precompile templates during deploy.
Is there a related Discourse thread or were any utilized (please link them)?
https://discourse.roots.io/t/best-practice-resources-for-blade/8341/72?u=swalkinshaw
Please provide use cases for changing the current behavior:
If you have a proper deployment process, pre-compiling templates is a better practice as it's done once ahead of time and you could catch failures before a page view happens.
I've been playing around with this a little. For this to work we need to be able to access the sage container outside of wordpress but right now it's only loaded inside a filter
@swalkinshaw if you want to do it during deploy I think it's a better idea to do it with git-hooks.
@schrapel isn't it possible to run these commands with WP-CLI?
Well you need to have a copy of wp cli installed and a active database. My Docker doesn't have MySQL installed
Git hooks is an option but you need to figure out how to compile with the same folder path on your web box. But if you have different folders on different servers a git hook won't work
@retlehs great tool!
Aside: _"Also, if your console supports it, the script uses emoji."_ Just WOW!
Closing this as that wp-cli package is exactly how this would need to be done. The only other option would be to add it to sage-installer or sage-lib.
Most helpful comment
https://alwaysblank.org/tool/blade-generator/