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

Broken starter kit Twig Demo #1486

Closed
JosefBredereck opened this issue Feb 12, 2023 · 2 comments · Fixed by #1490
Closed

Broken starter kit Twig Demo #1486

JosefBredereck opened this issue Feb 12, 2023 · 2 comments · Fixed by #1490

Comments

@JosefBredereck
Copy link
Contributor

JosefBredereck commented Feb 12, 2023

I am using Pattern Lab Node v6.0.1 on Windows | Mac | Linux, with Node v16.17.0, using a Twig Edition.

The Twig Demo is currently not working as expected. There are several issues regarding the pattern data and template loading.
Pages including templates which include other components are not referencing the data provided by the provided companion JSON file.

Expected Behavior

When I install the starter kit via patternlab install --starterkits @pattern-lab/starterkit-twig-demo it should provide a good stating point with basic components and example pages.
Twig files provided under pages should include templates which correctly consume the companion JSON.

For example: The data of homepage.json should correctly be used in pages/homepage.twig which includes templates/homepage.twig

Actual Behavior

I can install the starter kit, but the JSON data from pages is not applied to the output.

Steps to Reproduce

  1. npm create pattern-lab
  2. follow the steps to install twig
  3. patternlab install --starterkits @pattern-lab/starterkit-twig-demo
  4. npm run start
  5. Navigate to pages ⇾ homepage
@hadl
Copy link
Contributor

hadl commented Feb 25, 2023

Tried with: Homepage JSON Data -> Hero

Data is applied correctly but there are some issues with the structure and passing the data in Twig.

  1. hero is an array not an object
  2. including block-hero.twig needs with hero so the data is "flattened"

I saw that, in my installation, the macros namespace was not included in the patternlab-config.json -> error rendering atoms-text-fields.
After fixing that there is a notice too: Could not find pattern referenced with partial syntax "_macros/forms.twig" from "./source/_patterns/". which makes sense due to _macros folder outside of "root pattern dir".
For my projects i am only registering "custom namespaces" inside the _patterns directory and for e.g. marcos hiding that folder via .md file.
Maybe that folder should be moved so the linage would find that import too?

I would take care of that and provide a PR in the next days - If noone is currently working on that, ok?

@JosefBredereck
Copy link
Contributor Author

Feel free to take on this issue. My experience with twig is close to zero, so I would appreciate if someone could resolve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants