Skip to content

[Feature Request] Anonymous Name Resolution Fallback #1998

Open
@snoweuph

Description

@snoweuph

It would be cool, if the Anonymous component with the same name as its Directory would be used as a fallback if one with an exact match isn't found

Currently, you would do:
/components/Menu/Menu.html.twig
<twig:Menu:Menu/>

It would be cool to be able to write:
<twig:Menu/>
And have it fallback to
/components/Menu/Menu.html.twig
in case that:
/components/Menu.html.twig
is not found.

Reasoning

Pros ✅ Cons ❌
If Components get more complex, you tend to split them up, and organize them in subdirectories. Having the "Index" component outside its subdir only makes it more cluttered and harder to find stuff. This would fix that. This can only be a fallback, to ensure backwards compatibility and because of Name conflicts
You Don't Get Duplication in Names anymore, which make it easier to read, and more fun to write templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRFC = Request For Comments (proposals about features that you want to be discussed)TwigComponent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions