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

refactor: remove site config from theme config #4145

Merged
merged 1 commit into from
Feb 25, 2020

Conversation

SukkaW
Copy link
Member

@SukkaW SukkaW commented Feb 23, 2020

What does it do?

# _config.yml under hexo directory
a:
  foo: 'bar'
c: 'vaz'
# _config.yml under theme directory
a:
  foo: 'abc'
b:
  baz: 'vrf'

Before this PR

In theme template:

  • theme.b.baz --- vrf

  • config.a.foo --- bar

  • theme.a.foo --- abc

  • config.c --- vaz

  • theme.c --- vaz

After this PR

In theme template:

  • theme.b.baz --- vrf

  • config.a.foo --- bar

  • theme.a.foo --- abc

  • config.c --- vaz

  • theme.c --- Throw undefined error


Since current behavior (merge site config into theme config) is not documented, I am assuming there is no theme developer is relying this behavior.

How to test

git clone -b remove-site-config-from-theme-config https://github.com/sukkaw/hexo.git
cd hexo
npm install
npm test

Screenshots

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@SukkaW SukkaW requested a review from curbengh February 23, 2020 07:29
@curbengh
Copy link
Contributor

Before deepMerge is used, it was Object.assign(), but I'm not sure why it's there in the first place. Duplicating the config into theme is indeed unnecessary. Another guess is that theme_config can override config, but this is undocumented and risky.

@SukkaW SukkaW merged commit 225abd5 into hexojs:master Feb 25, 2020
curbengh added a commit to curbengh/hexo-renderer-stylus that referenced this pull request Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants