-
Notifications
You must be signed in to change notification settings - Fork 404
Added separated pattern-folder support #992
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
Added separated pattern-folder support #992
Conversation
Added the functionality to separate the patterns from each other by adding the support for a capsulation folder by pattern. Also added tests.
Only replace the last occurence of the nested pattern folder. like grid-system-grid to grid-system as main folder.
Co-Authored-By: JosefBredereck <stylaone@live.de>
Like @engelfrost suggested it should be the same name, so that there is no error with the pattern group and subgroup names.
…/SlimeGames/patternlab-node into feature/separated-pattern-folder
Wait - PL Node didn't previously allow grouping together related component files like this? 😅
|
Have we tested / confirmed that this works with folders that have number prefixes to adjust the ordering (ex. |
This is nesting one step deeper. buttons/button.(extensions) works as desired. But If you put your button under the
With the suggested change from @engelfrost, it won't work that way, you have to name your files with the number prefix too. |
Exactly and the first image shows my trouble all the time. To much files. I know it differently from Angular where you have your components in different folders separated from each other. (That's the second image) |
I totally agree. The only issue I have here (and it’s a really big one) is requiring children of the parent component folder (ex. files in the The whole point of the number prefixes is to be able to easily change the order that patterns show up, not be a unique identifier to know X children are related to Y parent. Given that + this being a major breaking change for folks using PL PHP looking to migrate over to PL Node (once the new PHP Twig Renderer ships), how hard would it be to get this nesting support in place without requiring the nested files to share the same number prefix? |
In my first idea, it wasn't necessary to have the same number prefix but it would lead to a problem with the subgroup of the pattern. An idea maybe would be if the containing folder ends with the same name as the pattern has.
If you want to change the order you have to rename all files today also, haven't you?
The old way still exists. So migrating shouldn't be a problem. Also, upgrading from PL 2.3 to PL 3.0 should work easily. |
What if the name has to match exactly, but you are required to drop the numbering on the files?
Files that don't follow the naming scheme would trigger warnings and should not be rendered IMO:
I have very little knowledge about the PHP version, what is it that would be broken? |
I will implement that because I like it much more than the additional numbering in the subfolder. |
It is now possible to set up patterns like `../00-colors/00-colors.(extension)` or `../00-colors/colors.(extension)` the match will be the pattern name without the prefix numbers.
…ted-pattern-folder Added separated pattern-folder support
Added the functionality to separate the patterns from each other by adding the support for a capsulation folder by pattern. Also added tests.
Summary of changes:
This change will allow to provide a folder stucture like this
but also the old way (so that we stay backward compatible)
With a directory structure of that example:
which will result into