Closed cbvar closed 4 years ago
@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.
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);
});
Those lines seem to solve this question: https://github.com/hexojs/hexo-renderer-stylus/blob/master/lib/renderer.js#L5
doesn't it?
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.
Use theme_config
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?