-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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(nunjucks): dedicated nunjucks renderer #4356
Conversation
5e6f891
to
fd71d31
Compare
I tested the forked next theme from mimi, but got error. Is there any difference between next built-in and this? @stevenjoezhang # create project
hexo init test-dir
cd test-dir
# fork and use next theme
git clone https://github.com/next-theme/hexo-theme-next themes/next
rm themes/next/scripts/renderer.js
hexo config theme next
# use this hexo version
yarn add sukkaw/hexo#split-nunjucks
# run
hexo cl && hexo s |
It appears that there are some nunjucks filters added by @stevenjoezhang in Also, the PR (migrated from @oncletom) uses |
@stevenjoezhang I could include |
I would appreciate if the |
@stevenjoezhang A new filter |
@curbengh I have ported the nunjucks renderer from @stevenjoezhang. This time the nunjucks renderer should work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WFM, this time I didn't remove themes/next/scripts/renderer.js
.
@curbengh Remove it and try again see if it works? |
Is it supposed to get removed? I got following error after remove:
|
Yes. New NexT theme has a built-in nunjucks renderer which should be removed after this PR is merged (As the PR is attempt to replace it). There must be something wrong with relative path resolving. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand the difference between "dedicated renderer" and "a plugin of hexo" (as a user feature).
The initial intent of providing the renderer as a plugin was to uncouple the rendering with hexo mecanics — this way, defaulting to a different renderer is just a matter of switching a renderer dependency from one to another.
What you are doing here is fairly good addition to the core plugin, it would totally make sense you contribute it upstream.
Rebased. @stevenjoezhang Would you mind reviewing the PR again? @curbengh Try removing |
You mean
|
@curbengh This time should work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What does it do?
The continuation of #2903.
In every case,
hexo-renderer-*
is considered as a plugin of hexo (not a dependency of hexo). When hexo uses swig as a default renderer,hexo-swig-renderer
exists but it is not a dependency of hexo.In this PR I remove
hexo-renderer-nunjucks
and bring up a dedicated nunjucks renderer.I have written a custom
toArray
to avoidlodash.toarray
,How to test
Screenshots
Pull request tasks