Skip to content

Define custom component directory and import custom components #729

Closed
@olavoasantos

Description

@olavoasantos

Feature request

Allow developers to use the config.js file to customize the components folder and to import components with custom names.

What problem does this feature solve?

Currently, VuePress looks for a components folder inside the .vuepress folder. If we are aiming to integrate VuePress into an existing project (or use it to document a custom component package), this would drive us to move or copy existing components to this folder. This results in either verbosity (as we would have to import from ./path/to/.vuepress/components) or duplication.

Moreover, the current implementation does not allow us to import custom components with a custom name tag, relying solely on the folder structure of the component (e.g. <Path-To-Custom-Component></Path-To-Custom-Component>.

What does the proposed API look like?

  • Custom component directory:

carbon 25

  • Custom component import:

carbon 24

How should this be implemented in your opinion?

First, modifying the resolveOptions.js to accept two new options (components and componentsDir). Then, modifying the genImport function in the codegen.js to accept these options and generate the imports based on their values.

Are you willing to work on this yourself?**

Yes. #730

Metadata

Metadata

Assignees

No one assigned

    Labels

    version: nextPlanned to do or already included in the next(1.0.0) version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions