-
Notifications
You must be signed in to change notification settings - Fork 405
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
Pattern Parameters Not Always Working #240
Comments
Good catch - I just confirmed this too. Frustrating when unit tests miss something, time for another one! It might be a good idea to add some parameters to the sample patterns as they are easy to spot check too. If you don't get to the bottom of this I'll be looking into it soon too. |
The shipped |
Looks like 'patternlab.partials' object is empty at https://github.com/pattern-lab/patternlab-node/blob/dev/builder/parameter_hunter.js#L60 Seems like this slipped through other applications because of the nested nature of the template/pages reuse of the partial with pattern parameters, where other instances didn't need the partial object at all. |
@bmuenzenmeyer, I was just working on an underscore engine in the other branch, and I was wondering about the right way to do stuff like this. From patternlab.patterns = [];
patternlab.partials = {}; I know patternlab.patterns is meant to be array storage of every pattern template (do we call these partials?) that's been detected. patternlab.partials is less clear to me. Is it meant to be all patterns, plus "free" (non-pattern) partials from somewhere? Or is this meant to be the key/value version of patternlab.patterns? |
Hi @geoffp !
I call these patterns still, though they are of course standalone and can be made partials.
I've been thinking about this all night. Okay not like keep-me-up-at-night level stuff, but I'm beginning to think that the complete disuse of What I'll probably do/propose is keeping |
For those following along too - there needs to be a |
I personally don't mind having two alternative data structure for holding patterns -- they'd just be storing references to the same objects, but ordered in different ways. Sometimes you may need the ordered, array-like pattern store; other times, you may need quick access by pattern key. Some smart person whose name I forget said something like, "if your data structures are correct, your algorithms will be trivial". I toyed with creating The interesting thing about the pattern-engines branch is that templating engines have different things they want around partials. Mustache wants you to hand it a big object of named partials to enable its native partial calls, though I'm not sure we use that in PL/Node because we recurse into partial calls and sort of "flatten" them manually so we can have stuff like style modifiers and parameters. Handlebars, on the other hand, wants you to call a function to register each partial so it can have its own, internal accounting of partials. To that end, I've added a registerPartial hook for engines that gets called by addPattern() if the engine implements it. Underscore is a nightmare because it doesn't even have a concept of partials at all, so you have to bolt one on (which my team has done). |
Thinking about it further, though -- I think |
This just landed in I think I missed a test scenario I will go back and check, but for the most part this is working |
This issue will close automatically when it reaches |
@bmuenzenmeyer Been wanting to contribute for a while, but was tied down with an insane deadline at work. Anyhow, the last version I had been using was 0.13.0, and after upgrading to 1.0.0, parameter submissions are broken.
To replicate:
I'm hoping to submit a pull request fairly soon in order to fix this, as well as making recursive parameter submission more robust.
The text was updated successfully, but these errors were encountered: