patternlab-node
patternlab-node copied to clipboard
error at build when two pattern folders uses the same name with a different number
I am using Pattern Lab Node v2.4.0
on Mac with Node v6, using the Gulp Edition.
Expected Behavior
throw a more explicit error like pattern directory name duplicated : XXX
Actual Behavior
throw this error Could not find patternType 01-atoms-01-atoms. This is a critical error.
and fail the build
Steps to Reproduce
name two folders _patterns/00-atoms/00-images
and _patterns/00-atoms/01-images
and build/watch
Thanks for reporting this @gael-boyenval - glad we were able to debug it and keep you running
@bmuenzenmeyer you're welcome, i thank you very much for the help.
This also happens in the other pattern folders - including for SEO (it took me a long time to find this bug report!)
Could not find patternType 01-molecules-01-molecules. This is a critical error.
Could not find patternType 02-organisms-02-organisms. This is a critical error.
Could not find patternType 03-templates-03-templates. This is a critical error.
Could not find patternType 04-pages-04-pages. This is a critical error.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
To fix this issue we will need to make a breaking change. At the moment the shorthand pattern name will be generated from patternType-patternName
.
To be sure that this isn't happening anymore there will be two approaches.
- Generate shorthand name as
patternType-patternSubType-patternName
which feels a bit too long. - Alternatively, we add a markdown pattern-property which allows adding an individual shorthand name for that pattern. after that, you can reference the pattern by that name which will be
patternType-customShorthandName
The shorthand syntax leads to PL lockin. I'd rather us do away with any logic whatsoever that contributes to patterns not being portable.
Experiencing this as well. In the process up upgrading from version 2.7 to latest. Got all the twig functions and filters migrated to new version and finally building now. But now the build errors with
Could not find patternType 01-components-01-components. This is a critical error.
⊙ patternlab → TypeError: Cannot read property 'patternSubtypeItems' of undefined
Is there any work around until the issue is resolved?
Use links without numbers components-component
Given that the numbering scheme of folders and files will be deprecated in the near future (#1028), I doubt something will be done about this.
@bmuenzenmeyer can this issue be closed?
It's not about the numbers it's about the names.
The shorthand syntax leads to PL lockin. I'd rather us do away with any logic whatsoever that contributes to patterns not being portable.
Given that #1181, #1176, and #1028 are in place and handlebars (see) or other rendering engines have their own way of referencing partials we have to find another way to solve this issue.
But also handlebars or twig are looking for a registered partial when referencing patterns. We register all partials (for example) in engine-handlebars or engine-twig and we generate that partial in core-object_factory. Given the fact that we still use the shorthand version the only way to overcome the given issue would be to update the pattern partial to patternGroup-patternSubGroup-patternName
or to the path of the pattern patternGroup/patternSubGroup/.../patternName
.
After removing the ##- prefix it shouldn't be possible to do the following
_patterns/00-atoms/00-images and _patterns/00-atoms/01-images
and the only way a pattern name could exist twice would be when you have those two files _patterns/atoms/images/cool-image.*
and _patterns/atoms/other-images/cool-image.*
, because you will get a resulting name/partial of atoms-cool-image
.
Any suggestions or opinions?