pattern-lab / patternlab-php-core

This repository provides the core functionality for Pattern Lab. It is meant to be used from within an Edition with a PatternEngine and StarterKit.
http://patternlab.io/
MIT License
43 stars 62 forks source link

PatternData ksort combined with NavItemsExporter array indexes squashes components menu items together #173

Open bdylanwalker opened 5 years ago

bdylanwalker commented 5 years ago

I have two components button and button-box. Buttons are what they sounds like. Button boxes are made up of a title, text, and button. I'm using the Gesso Drupal 8 theme which includes pattern lab, so these components are stored in directories named button and button-box under _patterns/03-components. When PL creates the navigation menu it puts all of the button components in the button box menu item. This is because the result of the ksort puts button and button-box before the component files stored in those directories. During the navigation export all the button components appear to be related to the button-box pattern. The result of the sort looks like this:

button
button-box
button-box/_button-box.scss
button-box/button-box.twig
button-box/button-box.yml
button/_button.scss
button/button.twig
button/button.yml

I can fix it by renaming the button directory to buttons, but I've run into a couple of other component names given by designers that are causing this problem so I'd like a better solution.

sghoweri commented 5 years ago

I’d need to look more closely into this (specifically the clue in your issue title) but from experiencing this firsthand I know EXACTLY which bug you are seeing!