Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix($core): load theme bug and typo #1247

Merged
merged 4 commits into from
Jan 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages/@vuepress/core/lib/prepare/loadTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,15 @@ module.exports = async function loadTheme (ctx) {

const layoutComponentMap = layoutDirs
.map(
layourDir => readdirSync(layourDir)
layoutDir => readdirSync(layoutDir)
.filter(filename => filename.endsWith('.vue'))
.map(filename => {
const componentName = getComponentName(filename)
return {
filename, componentName,
filename,
componentName,
isInternal: isInternal(componentName),
path: path.resolve(layourDir, filename)
path: path.resolve(layoutDir, filename)
}
})
)
Expand All @@ -148,14 +149,15 @@ module.exports = async function loadTheme (ctx) {

const { Layout = {}, NotFound = {}} = layoutComponentMap

if (!Layout && !fs.existsSync(Layout.path)) {
// layout component does not exist.
if (!Layout || !fs.existsSync(Layout.path)) {
throw new Error(`[vuepress] Cannot resolve Layout.vue file in \n ${Layout.path}`)
}

// use default 404 component.
if (!NotFound || !fs.existsSync(NotFound.path)) {
layoutComponentMap.NotFound = {
filename: 'Layout.vue',
filename: 'NotFound.vue',
componentName: 'NotFound',
path: path.resolve(__dirname, '../app/components/NotFound.vue'),
isInternal: true
Expand Down