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

[TwigComponent] Autodiscover from bundles #1714

Open
cavasinf opened this issue Apr 10, 2024 · 7 comments
Open

[TwigComponent] Autodiscover from bundles #1714

cavasinf opened this issue Apr 10, 2024 · 7 comments

Comments

@cavasinf
Copy link
Contributor

cavasinf commented Apr 10, 2024

The goal is to convert every "twig macro component" into TwigComponent (kevinpapst/TablerBundle#173) in TablerBundle.

As of today, there is no "best practice" or "how to" for implementing TwigComponent in bundles.
With the multi namespace available, we can configure it like this:

twig_component:
    defaults:
        KevinPapst\TablerBundle\Twig\Components\:
            template_directory: '@Tabler/twig_components/'
            name_prefix: Tabler

Note

Keep in mind the /twig_components folder.

  1. Will an auto-discovery be available later like Bundle Templates to auto map Bundle TwigComponents?
  2. Should each twig file in <your-bundle>/templates/components be mounted as a Twig Component?
    In our case, we already have a components folder that is NOT planned for Twig Component (this can be solved internally).
  3. Depending on the answer to 2., can a bundle have "anonymous" components?
  4. Should the DI only inject php classes that have the Symfony\UX\TwigComponent\Attribute\AsTwigComponent attribute and not mount them from "is there twig files in templates/components"
  5. Can a TwigComponent be overrided like Bundle templates
@smnandre
Copy link
Member

Concerning autodiscover / bundle component, i'll make you a general answer :)

It's somehting we worked on and.. paused (to release some LiveComponent fixes and UX Icons).

I'll work on it next week as i had an almost ready PR for all this, we "just" need to act some things regarding namespaces.

Stay tuned ? :)

@cavasinf
Copy link
Contributor Author

Stay tuned ? :)

I'll ping you next week then 😉

@kevinpapst
Copy link

Let me be the ping on that one. Can we help with a real world example?
Do you have a working branch that we can help testing @smnandre ?

@smnandre
Copy link
Member

smnandre commented May 3, 2024

Nothing like that nope sorry…. But if you want, i can find 30mn during the week-end to centralize all the needs / hidden problems / things we want to préserve, etc

@carsonbot
Copy link

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@kevinpapst
Copy link

@smnandre has there been any progress on that topic? Having such a feature could improve the spreading of UX initiative, if we can publish components in bundles.
We can help, but need some input on the how and where.

@carsonbot carsonbot removed the Stalled label Nov 4, 2024
@smnandre
Copy link
Member

smnandre commented Nov 4, 2024

This now works for anonymous components: https://symfony.com/bundles/ux-twig-component/current/index.html#3rd-party-bundle

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

No branches or pull requests

4 participants