Skip to content
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

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

Merged
merged 3 commits into from
Apr 17, 2021

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