Skip to content
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

Want to get pattern~variant.json files to act like they do in patternlab-php #150

Closed
e2tha-e opened this issue Sep 20, 2015 · 1 comment
Closed

Comments

@e2tha-e
Copy link
Contributor

e2tha-e commented Sep 20, 2015

I'm submitting a pull request to refine the mergeData function in pattern_assembler.js. The short description is so that pattern~variant.json files behave as they do in patternlab-php.

As it stands, in patternlab-node, the data in the 2nd param overwrites the data in the 1st param, which in most cases, is what you want. However, this is problematic in pseudopattern_hunter.js, because the 1st param is variantFileData. What this means is that if a variant data property has the same key as the primary pattern's, the variant will show what's assigned to the primary pattern.

As an example, say 00-homepage~emergency.json had a property "title" with value "Emergency". 00-homepage~emergency's title will be "Home Page" and not "Emergency". Simply reversing the parameter order won't fix things because then, the non-emergency 00-homepage will show the emergency block.

In order to fix this, I had to reverse the order of parameters in pseudopattern_hunter.js. I then had to update the mergeData function in pattern_assembler.js so it checks that the parameter in obj2 is undefined before copying the value over from ob1.

@bmuenzenmeyer
Copy link
Member

Merged to dev - will autoclose when released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants