Skip to content
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

feat(twig-paths): better resolve of twig component path with twig.yaml config #32

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Taloud
Copy link

@Taloud Taloud commented Jul 31, 2024

We are now using the paths in twig.yaml config to resolve the twig_components paths.

Fix of #31

TODO: update the tests suite

@@ -1,4 +1,5 @@
{
"version": "0.0.0",
Copy link
Author

@Taloud Taloud Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Needed for older versions of npm / yarn. Can't build without it.

@Taloud Taloud force-pushed the feat/use-twig-config-paths branch from 65de07a to a8bea0a Compare August 5, 2024 15:48
@Taloud Taloud marked this pull request as ready for review August 5, 2024 15:49
@Taloud Taloud changed the title [WIP] feat(twig-paths): better resolve of twig component path with twig.yaml config feat(twig-paths): better resolve of twig component path with twig.yaml config Aug 5, 2024
@Taloud
Copy link
Author

Taloud commented Aug 26, 2024

Just a quick follow-up on this 👼. I’m available to discuss it if necessary.

@Taloud
Copy link
Author

Taloud commented Aug 30, 2024

Hello, I don’t really understand why I’m getting PHP CS Fixer issues when I’m not touching a single PHP file. I can run the fixer command, but it doesn’t seem related to me, right?

I will look into the sandbox because I don’t know much about it either, and I will try to fix this. Thanks

@squrious
Copy link
Collaborator

Hello, first of alls sorry for the delay, didn't get free time to work on the projet during past weeks.

You can safely ignore the PHP CS fixer errors. The CI always uses the latest version/rules, and sometimes it breaks, but I'll fix that in another PR.

For the sandbox, yes there is a problem actually. My guess is it is about how the configurations are processed in framework-preset.ts. If the Symfony project doesn't configure paths explicitely, then you have no paths to use in the resolver. A fix could be to append the default template directory if no one is provided:

    // ...
    const twigPaths: string[] = Object.keys(twigConfig.paths).map((key) => `${projectDir}/${key}/`);
     
     // Fix:
     if(twigPaths.length === 0) {
         twigPaths.push(`${projectDir}/templates`);
     }
    // ...

The global implementation in you PR looks great to me, thank you for your work! I'll make a deeper review soon ;)

@Taloud
Copy link
Author

Taloud commented Aug 30, 2024

Hello, no problem, and thanks for the review!

I’ve pushed the fix. I don’t really know how to run the sandbox test, but I’ll look into it more if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants