[6.x] Blade parity#19148
Open
riasvdv wants to merge 13 commits into
Open
Conversation
Comment on lines
+80
to
+83
| private function isBlade(string $path): bool | ||
| { | ||
| return Str::endsWith($path, '.blade.php'); | ||
| } |
Contributor
There was a problem hiding this comment.
Could we make this the responsibility of the renderer or engine, instead? Something like…
- Resolve template path
- Define list of renderers
- Emit event so plugins can add new ones
- Call (e.g.)
RendererInterface::matchPath()on each one, returning the first one that says it can render the provided path
Contributor
Author
There was a problem hiding this comment.
Thanks for this suggestion! I've refactored into an interface now with a BaseTemplateRenderer which does a lot of the ceremony, the BladeRenderer is just a small implementation of that now. In theory other renderers could also be added.
Contributor
There was a problem hiding this comment.
Sort of off-topic, but this is a cool refactor from RequireEdition!
Contributor
Author
There was a problem hiding this comment.
Yes! I noticed there were a lot of try-catches around it with the same 404 if debug mode is disabled, so this nicely consolidates it
There's probably some other places we could use this
d17bad6 to
3efc354
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adds initial Blade directives and an engine-agnostic renderer for Craft templates which brings near-parity for Blade templates
See docs/blade.md
Of course we can add more in the future or upon request