mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-15 08:15:54 +10:00
28 lines
596 B
JavaScript
28 lines
596 B
JavaScript
export function injectMixins (options, mixins) {
|
|
if (!options.mixins) {
|
|
options.mixins = []
|
|
}
|
|
options.mixins.push(...mixins)
|
|
}
|
|
|
|
export function pathToComponentName (path) {
|
|
if (path.charAt(path.length - 1) === '/') {
|
|
return `page${path.replace(/\//g, '-') + 'index'}`
|
|
} else {
|
|
return `page${path.replace(/\//g, '-').replace(/\.html$/, '')}`
|
|
}
|
|
}
|
|
|
|
export function findPageForPath (pages, path) {
|
|
for (let i = 0; i < pages.length; i++) {
|
|
const page = pages[i]
|
|
if (page.path === path) {
|
|
return page
|
|
}
|
|
}
|
|
return {
|
|
path: '',
|
|
frontmatter: {}
|
|
}
|
|
}
|