rspress icon indicating copy to clipboard operation
rspress copied to clipboard

[Feature]: Reusable theme scalability support

Open linbudu599 opened this issue 10 months ago • 2 comments

What problem does this feature solve?

Currently (from the documentation) rspress only supports extensions that create theme folders in the current directory, and does not support loading theme extensions from npm packages, which prevents the community from sharing theme packages such as rspress-theme-xxx for the rspress ecosystem.

What does the proposed API look like?

The intended API should consist of two parts:

  • New theme configuration items.
  • support for loading theme components from npm packages.
import * as path from 'path';
import { defineConfig } from 'rspress/config';

export default defineConfig({
  root: path.join(__dirname, 'docs'),
  theme: 'rspress-theme-blog',
  // should support extending types from theme package
  themeConfig: { },
});

Some additional things: Themes should normally be a superset of plugins, so plugins in the theme should also be able to be loaded properly.

linbudu599 avatar Apr 03 '24 02:04 linbudu599

Nice features! That's what we are going to support. Thanks your feedback. We will design the theme npm package exports and support loading theme package in this month.

sanyuan0704 avatar Apr 03 '24 03:04 sanyuan0704

It's a big feature and we should also implement theme inheritance like https://vuepress.vuejs.org/theme/inheritance.html#theme-inheritance do.

May be it will be implemented in 2.0 refactor?

Timeless0911 avatar May 13 '24 09:05 Timeless0911