Closed JosefBredereck closed 1 year ago
Tried with: Homepage JSON Data -> Hero
Data is applied correctly but there are some issues with the structure and passing the data in Twig.
hero
is an array not an objectblock-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?
Feel free to take on this issue. My experience with twig is close to zero, so I would appreciate if someone could resolve this.
I am using Pattern Lab Node
v6.0.1
onWindows | Mac | Linux
, with Nodev16.17.0
, using aTwig
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 includestemplates/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
npm create pattern-lab
patternlab install --starterkits @pattern-lab/starterkit-twig-demo
npm run start