Skip to content

Fallback directory for patterns and templates #4

@landwire

Description

@landwire

Hi there,
I was wondering if it is possible create something analog to the following timber fallback functionality with primer.

Timber will look first in the child theme and then falls back to the parent theme (same as WordPress logic). The official load order is:
User-defined locations
Directory of calling PHP script (but not theme)
Child theme
Parent theme
Directory of calling PHP script (including the theme)

I basically want to do the same with primer. So I have the resources directory and lets say resourcesChild directory. If a template xyz.twig is not existing in resourcesChild it will look in resources for xyz.twig and render that one. Obviously includes must work across the 2 directories too.
Is that possible to set up with primer?

Another question: Is it possible to use other names for the twig file than template.twig? I would like to use unique names for all patterns, basically following the following structure:

component-a
    component-a.twig
    component-a.scss
    component-a.js
    data.php -> I would prefer component-a.php, .yaml, .json

component-b
    component-b.twig
    component-b.scss
    component-b.js
    data.php -> I would prefer component-b.php, .yaml, .json

Thanks for any answers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions