Remove rendered Blades on theme install/uninstall #2121
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR would address some of the concerns in #1987. It doesn't add a command-line function for manipulating Blades, but it does make Sage a slightly kinder WordPress citizen by cleaning up Blades when installed/uninstalled, and provides some helper methods for doing that at other times. It endeavors to be relatively careful, and only delete the files it needs to delete, leaving other files alone.
The reason it doesn't examine existing Blade templates to find their rendered versions and delete those is because part of the ostensible purpose is to clean up unnecessary Blades when changing themes: If the original Blade templates have been changed or removed during development, the "orphaned" rendered files would not be found.
I considered adding the a "build all Blades on install" feature, but felt that was a little too presumptuous and could theoretically lead to significantly increased load when activating a theme if there are a lot of Blades to render. I'd be happy to modify the PR to add that feature, though.