-
Notifications
You must be signed in to change notification settings - Fork 404
fix(engine_twig_php): Twig incremental rebuilds #1036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(engine_twig_php): Twig incremental rebuilds #1036
Conversation
Fixes issue where edits to twig files included in parent do not appear until the parent file is updated. Closes issue pattern-lab#1015
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to see this working.
Hmmm. I feel like I’ve seen that Twig regex pattern before! 😊 |
Fixes issue where programmatically created twig includes would throw a warning at compile time. Closes issue pattern-lab#1015
I dont have the bandwidth to check out these Twig PRs, can someone else please review? |
🙋♂@bmuenzenmeyer starting to take a look at this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is almost good to go @zhawkins!
The main issue I ran into while testing this out has to do with resolving Twig namespaced-paths when the recursive
option is enabled.
Basically Twig includes like @molecules/teaser-card.twig
should work the exact same way as @molecules/teaser-card/teaser-card.twig
but with the added benefit of being able to move around templates internally without breaking a bunch of paths in the process.
I'm taking a look to see if I can adjust your findPartial
logic here to take this into account so a ton of warnings aren't thrown!
Fixed it! Now the shorter hand Twig namespace syntax works too (plus no missing templates / warnings when compiling). Pushing this update up shorty so we can get this merged. 🙂 |
# Conflicts: # packages/engine-twig-php/lib/engine_twig_php.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it! Now the shorter hand Twig namespace syntax works too (plus no missing templates / warnings when compiling).
Pushing this update up shorty so we can get this merged. 🙂
@zhawkins for reference, these were the couple of small things I had to change to get some additional Twig use cases accounted for.
Basically I updated your PR to look through all Twig namespaces after the Twig renderer recursively adds nested folders (vs the namespaces before the Twig renderer boots up) + added support for matching up partial Twig include paths (@molecules/teaser-card.twig
), in addition to the paths you commented on that include nested folders. Thanks again for this! 👍
Awesome! Thanks for doing that! 😎 |
…incremental-rebuilds fix(engine_twig_php): Twig incremental rebuilds
Fixes issue where edits to twig files included in parent do not appear
until the parent file is updated.
Closes issue #1015
Summary of changes:
findPartials
support which should find any partials that contain include, embeds or extends.findPartial
support which should take the include/embed/extend and use any provided namespaces to resolve a partial file. That partial file is used to return a pattern key.