Skip to content

Engine Twig PHP isn't very flexible with namespaces #1092

Closed
@zhawkins

Description

@zhawkins

I am using Pattern Lab Node v5.1.0 and engine-twig-php v5.1.0 on Mac, with Node v11.2.0, using edition-twig (php engine).

Expected Behavior

I should be able to use a twig namespace that's not a directory name and includes / embeds etc should work.

Actual Behavior

When using a twig namespace that's not close to atomic naming conventions (Atoms, Molecules, etc), included partials aren't resolved correctly.

Steps to Reproduce

Within patternlab-config.json add a new namespace with an ID that's not similar to a directory:

          "id": "some_thing",
          "recursive": true,
          "paths": [
            "source/_patterns/05-test"
          ]
        },

Within another pattern twig file, include a new component using this namespace:

{% include "@some_thing/00-test.twig" %}

You should see the warning:

Could not find pattern referenced with partial syntax @some_thing/00-test.twig.
This can occur when a pattern was renamed, moved, or no longer exists but it still referenced within a different template or within data as a link.

I recognize this is a super specific bug that may only impact me and my team so I've got a PR coming. 😄

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