Sage: Add option to precompile Blade templates

Created on 28 Feb 2017  路  6Comments  路  Source: roots/sage

Submit a feature request or bug report

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


Feature Request

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.

Most helpful comment

All 6 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tofraser picture tofraser  路  5Comments

williamscotholmes picture williamscotholmes  路  4Comments

jlariza picture jlariza  路  5Comments

mquellhorst picture mquellhorst  路  3Comments

MitchEff picture MitchEff  路  3Comments