Skip to content

fix(pseudopatterns): use the template instead of the pseudo data file…#1312

Merged
JosefBredereck merged 3 commits intopattern-lab:devfrom
mfranzke:fix-1308
Apr 17, 2021
Merged

fix(pseudopatterns): use the template instead of the pseudo data file…#1312
JosefBredereck merged 3 commits intopattern-lab:devfrom
mfranzke:fix-1308

Conversation

@mfranzke
Copy link
Contributor

@mfranzke mfranzke commented Apr 13, 2021

… for template rendering #1308

Closes #1308

Summary of changes:

Credits go to @AdrianRichardson who made the suggestion within https://gitter.im/pattern-lab/node?at=600c7cb597132e2480fcafe5:

(...) when rendering, pattern.relPath is used as the source file passed to Twing. However, when rendering a pseudo pattern, the value of pattern.relPath is the JSON/YAML file so the wrong thing is used for the template.

It looks like the required value is under pattern.basePattern.relPath when processing a pseudo-pattern. Changing

var patternPath = pattern.relPath;
to var patternPath = pattern.basePattern ? pattern.basePattern.relPath : pattern.relPath; seems to fix it.

Setup:

atoms/test/base-template.twig with atoms/test/base-template~pseudo.json will output just a copy of atoms/test/base-template~pseudo.json as atoms-base-template-pseudo.rendered.html, not the parsed HTML from the base-template.twig. It works OK with no pseudo pattern, ie atoms/test/base-template.twig and atoms/test/base-template.json

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.

Component variants display as YML

2 participants