-
-
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
The proposal of installing theme through npm #3890
Comments
FYI: |
Is there a good way to handle this situation? |
We could contact all owners of The package hexo-theme-next-anchor is indeed a plugin. For the package hexo-theme-next, it is a theme. so, in this case, no problem |
@SukkaW I edited your issue to add numbers for each items for 1. indeed, that is the pre requisite for 2. ok for 3. ok, but it will make the code a bit more complex because the theme_dir will be more complex to determine (not a big deal either) for 4. ok also, but this is a bonus for 5. this is not really a bonus, because without that, we cannot customize .less (and I believe it is probably the same for .sass If I have time, I'll start with 3. |
|
IMHO, distinguishing between a theme and a plugin is not complicated, you just need to determine whether a cc @1v9 |
Great proposal! Would love to use this feature. |
Another idea is only to exclude |
I just retested the item 5. and it seems to work without my changes. I must have tested wrong :) |
This brings me to another idea. We can configure in the configuration file, which need to be excluded |
@tomap Yeah, Line 360 in 5fba0a0
@jiangtj It would be more complex for a user to configure it.
|
Related progress. |
@tomap We could start by excluding |
Since this is already in progress, I'm unpinning this in favor of #4260. |
@SukkaW Maybe it's possible to release npm themes support before of Hexo 5? I'd like to have it without waiting for next release of Hexo. |
The Lines 306 to 309 in edef5c2
See: https://github.com/hexojs/hexo/blob/master/lib/theme/index.js , hexo/lib/theme/processors/config.js Lines 11 to 14 in edef5c2
That's right before |
When executing Lines 44 to 45 in 1489074
This will cause Hexo to load all themes except landscape as plugins. See also next-theme/hexo-theme-next#65 CC @hexojs/core |
Might be related with #4386. |
How about load the plugins in theme's dependencies? See my theme. I have add those needed dependencies. These plugins are required, but user muse install them in their blog project Here is a my solution, but I think it’s best done in hexo, do you think? |
By default So what you need is to make the theme loading required hexo's plugin, right? My thought is to include those plugins inside |
Yesh |
What about these kind of issues :
Because with a npm module you don't want to change any of |
Hindsight is 2020. We could have refused to automatically merge arrays, too late. Ideas:
|
Tu change color, you can rely on variables that go from config to css. I did that in my theme with stylus Declare a variable with proper name and boom |
@tomap ... check the title... what we're trying to do with Hexo 5 is configure the theme, not modify it's internals with no restrictions and breaking all hope of upgradeability. We only have the ability to modify the theme using predefined endpoints, like _confgi.landscape.yml. Case study of a mid sized mod to the landscape theme: vblip.com
|
Sorry for the late reply. Modifying the layout and styles with Hexo can be difficult because different themes use different template engines and have different code styles. Hexo provides an injector that allows you to insert HTML code at specific locations, but for more precise customization, the theme needs to provide relevant interfaces. Here are my suggestions:
I will close this issue because the main problem has been resolved. If you have any new questions, please feel free to open a new issue. |
The original discussion is at #2471
Here is my proposal:
hexo-theme-
prefixed package as a hexo plugin. See @tomap 's commit: master...tomap:feature/themeAsPackagediff-3d0f701643104f3b0e388b8f6a9a7f3eR38_config.yml
, because...themes/[name]
directory first, then searchhexo-theme-[name]
directory undernode_modules
. It means the theme underthemes
directory should have higher priority. In this way no extratheme_from_npm: true
configuration is needed.theme_config
in_config.yml
looks good, but it is better to have a separate theme config. We could introduce_config.[name].yml
. Currently,theme_config
has higher priority than_config.yml
under theme directories. After bring up_config.[name].yml
, I suggest thetheme_config in _config.yml > _config.[name].yml > _config.yml under theme directories
which will retain highest priority fortheme_config
.Also, we need to fix the issue that some plugins can not read theme config fromtheme_config
: Feature Request: Install theme through npm install #2471 (comment)IMHO, we could easily bring up this feature without any Breaking Changes: the theme structure, current configurations and setup will not be affected. Yes, I mean we can even bring up this feature during Hexo 4.x development.
cc @hexojs/core @jiangtj
The text was updated successfully, but these errors were encountered: