Skip to content

[Feature request] custom themeLayoutPath #600

Closed
@tyrion-yu

Description

@tyrion-yu

Feature request

What problem does this feature solve?

VuePress resolves theme by using path as vuepress-theme-${siteConfig.theme}/Layout.vue.
But for some security reason, some companies have their own npm registry. And the VuePress themes using in the company should only publish in the private npm registry. For no conflict with the public npm registry, the private npm packages published in the company should with a scope like @cip/vuepress-theme-security.

What does the proposed API look like?

in .vuepress/config.js

module.exports = {
  themeConfig:{
    layoutPath: `@cip/vuepress-theme-security`
  }
}

How should this be implemented in your opinion?

// resolve theme
const useDefaultTheme = (
  !siteConfig.theme &&
  !siteConfig.layoutPath &&
  !fs.existsSync(path.resolve(vuepressDir, 'theme'))
)

// prepare.js
try {
  const layoutPath = siteConfig.layoutPath? `${siteConfig.layoutPath}/Layout.vue`
    : `vuepress-theme-${siteConfig.theme}/Layout.vue`
  themeLayoutPath = require.resolve(layoutPath, {
    paths: [
      path.resolve(__dirname, '../node_modules'),
      path.resolve(sourceDir)
    ]
  })
  themePath = path.dirname(themeLayoutPath)
}

Are you willing to work on this yourself?**

I'm not sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: feature requestRequest to add a new featureversion: 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