pengzhanbo / vuepress-theme-plume

Vuepress Theme. A simple, feature-rich, document & blog
https://theme-plume.vuejs.press
MIT License
48 stars 11 forks source link

Is There a Plan to Provide Slots and Aliases Like VuePress Default Theme? #89

Closed KrLite closed 1 week ago

KrLite commented 3 weeks ago

As the title says, VuePress default theme provides extendable components and layouts through slots (<slot />) and aliases (@theme/...). Currently I found Plume doesn't provide such features, and all the components are hard-coded, which results in a low extendability.

Although Plume makes most of its components perfect and pretty, there are indeed some demands to extend or modify Plume's components. For example, extend the <BackToTop /> component to a circle stroked style like what in VuePress default theme. This could be done easily if the component has an alias and some slots.

In practice, the template of the new BackToTop.vue might look like:

<template>
  ...
    <button>
      <slot>
        <!--Default Implementation-->
        ...
      </slot>
    </button>
  ...
</template>

...and, aliases will need to be defined as mentioned here.

If this feature is okay, I'm always happy to contribute in migrating all current components to support slots and aliases.

pengzhanbo commented 3 weeks ago

I am considering adding <slot /> slot support for extensibility.

In fact, I am planning further theme refactoring, including features like extending slots and component overrides, as well as supporting more flexible page custom layouts.

When I initially created this theme, my goal was to incorporate as many desired features as possible, while keeping the configuration simple and flexible for users to focus on content creation. Consequently, I had to omit many more advanced extension supports.

KrLite commented 3 weeks ago

No worries! The current appearances of the theme is good enough to provide an out-of-the-box experience. I will look forward to the future extending and overriding features.

pengzhanbo commented 2 weeks ago

Named slots and component overrides are now supported in the new version, but I haven't prepared the documentation yet. If you need them urgently, you can check Layout.vue to learn about all the supported named slots. @theme/xx is consistent with @vuepress/theme-default.

KrLite commented 1 week ago

Thanks! That's surprisingly fast!