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

if hexo-config support get attr from site config file #11

Closed
cbvar opened this issue Aug 22, 2016 · 5 comments · Fixed by #41
Closed

if hexo-config support get attr from site config file #11

cbvar opened this issue Aug 22, 2016 · 5 comments · Fixed by #41

Comments

@cbvar
Copy link

cbvar commented Aug 22, 2016

When i call hexo-config('root') from styl file, it return empty because theme lack of 'root' attr. So i think that if hexo-config shoud support get attr from site config file again, or how to handle the root problem?

@cbvar cbvar changed the title hexo-config是否应该支持对site配置项的支持 if hexo-config support get attr from site config file Aug 22, 2016
@sebdeckers
Copy link

@cbvar I just faced the same problem. It looks like we have to use the theme configuration (/themes/your-theme-name/_config.yml) instead of the main Hexo configuration file (/_config.yml).

@tommy351 Would it not make sense to allow looking up in the main configuration properties? Maybe as a fallback, so it would not break existing themes. My use case is to read the url and root properties to generate absolute URLs in CSS.

@kgraves
Copy link

kgraves commented Nov 7, 2016

I also just ran into needing this for a Hexo project. Only the theme's config is available through hexo-config, but I want to be able to customize my site through settings in my config file. To be backwards compatible like @CBas suggested, something like the following might suffice:

style.define('hexo-site-config', function(data) {
  return getProperty(self.config, data.val);
});

@tomap
Copy link
Contributor

tomap commented Feb 27, 2019

Those lines seem to solve this question:
https:/hexojs/hexo-renderer-stylus/blob/master/lib/renderer.js#L5

doesn't it?

@stevenjoezhang stevenjoezhang linked a pull request Apr 25, 2020 that will close this issue
@stale
Copy link

stale bot commented Apr 25, 2020

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.

@stale stale bot added the wontfix label Apr 25, 2020
@stevenjoezhang
Copy link
Member

Use theme_config

#41

@stale stale bot removed the wontfix label Apr 25, 2020
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 a pull request may close this issue.

5 participants