Skip to content

Includes additional twig syntax featires #1367

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

Merged
merged 3 commits into from
Nov 21, 2021

Conversation

mogsie
Copy link
Contributor

@mogsie mogsie commented Nov 2, 2021

The twig tags "from," "import" and "use" are not understood by patternlab. They all use the same techniques as include, embed etc when resolving template names.

Some twig templates use {%- ... -%} syntax that gobble up the whitespace on each side. This change ensures that this syntax is understood when looking for partials.

I wasn't aware of the {%~ syntax (line-whitespace trimming) introduced in 2.8; I could add support for that too.

"from," "import" and "use" are both twig built-in, and uses the same techniques as include, embed etc when resolving template names.

Some twig templates use  {%- ... -%} syntax that gobble up the whitespace on each side. This change ensures that this syntax is understood when looking for partials.
@JosefBredereck
Copy link
Contributor

Some twig templates use {%- ... -%} syntax that gobble up the whitespace on each side. This change ensures that this syntax is understood when looking for partials.

Will this break any existing functionality?

@mogsie
Copy link
Contributor Author

mogsie commented Nov 5, 2021

Will this break any existing functionality?

No, it shouldn't. This code is only used when determining the "graph" of template dependencies, as far a I know. Twig understands the {%- .. -%} syntax, and has done so forever. When you use {%- include in a twig file, patternlab doesn't detect the dependency between this template and the included template.

@mogsie
Copy link
Contributor Author

mogsie commented Nov 5, 2021

I noticed I changed "engine-twig" and not "engine-twig-php" which I linked for documentation purposes; I should probably do both, and align this properly.

@JosefBredereck JosefBredereck merged commit 1ebcd53 into pattern-lab:dev Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants