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

Merge data from data files and src file #55

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Huntedpix
Copy link

Hi !

I needed to be able to merge datas from the data directory and the data from the src file (yml) to avoid re-writing of all the key (as it could sometimes be really long)

Example:

Data file "site":

navigation:
  primary: yes
  footer: yes

src file (*.md):

site:
  navigation:
    footer: false

To get data as:

navigation:
  primary: yes
  footer: false

As I think this might interest you, I created this pull request, feel free to merge :)

Huntedpix and others added 2 commits January 25, 2017 15:40
Merge data from data file and src file via yaml front matter
@doowb
Copy link
Member

doowb commented Mar 31, 2017

Hi @Huntedpix thanks for the PR and sorry for the delayed response. I've checked this locally and there is data being "leaked" between pages due to merging. I'm not exactly sure where it's happening, but if you rebase your changes against master and run grunt assemble you'll see that some of the pages in test/actual end up with titles from other pages.

If you can track it down and update the PR with a fix, that would be great, but also know that we're working on the "refactor" branch so that grunt-assemble will use the latest version of assemble.

As the documentation of lodash explain it, the first argument for the merge function is the destination object.
(https://lodash.com/docs/2.4.2#merge)

So the first argument was changing and it was not the behavior we excepted.
@Huntedpix
Copy link
Author

Hi @doowb !

Sorry for the delayed response, I was assign to a priority project.

The leaked information come from a simple error. As I'm not familiar with lodash, I misread the documentation and I have assume the behavior of _.merge().

I've made some test locally and everything seems ok.

@Huntedpix Huntedpix closed this Aug 31, 2017
@Huntedpix Huntedpix reopened this Aug 31, 2017
This reverts commit 3714f037a791f651d043edb81a3881c3428b5c03.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants