Skip to content

The proposal of installing theme through npm #3890

@SukkaW

Description

@SukkaW

The original discussion is at #2471

Here is my proposal:

  1. We should not treat hexo-theme- prefixed package as a hexo plugin. See @tomap 's commit: master...tomap:feature/themeAsPackagediff-3d0f701643104f3b0e388b8f6a9a7f3eR38
  2. Users are still required to specify their theme's name in _config.yml, because...
  3. Hexo will read themes/[name] directory first, then search hexo-theme-[name] directory under node_modules. It means the theme under themes directory should have higher priority. In this way no extra theme_from_npm: true configuration is needed.
  4. 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 the theme_config in _config.yml > _config.[name].yml > _config.yml under theme directories which will retain highest priority for theme_config.
  5. Also, we need to fix the issue that some plugins can not read theme config from theme_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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions