Skip to content

Commit

Permalink
refactor($default-theme): simplify & reorganize
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Oct 5, 2018
1 parent 7345515 commit e231744
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 34 deletions.
2 changes: 1 addition & 1 deletion packages/@vuepress/theme-default/components/NavLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</template>

<script>
import { isExternal, isMailto, isTel, ensureExt } from '../layouts/util'
import { isExternal, isMailto, isTel, ensureExt } from '../util'
export default {
props: {
Expand Down
2 changes: 1 addition & 1 deletion packages/@vuepress/theme-default/components/NavLinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<script>
import DropdownLink from './DropdownLink.vue'
import { resolveNavLinkItem } from '../layouts/util'
import { resolveNavLinkItem } from '../util'
import NavLink from './NavLink.vue'
export default {
Expand Down
1 change: 0 additions & 1 deletion packages/@vuepress/theme-default/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ $navbar-horizontal-padding = 1.5rem
.navbar
padding $navbar-vertical-padding $navbar-horizontal-padding
line-height $navbarHeight - 1.4rem
position relative
a, span, img
display inline-block
.logo
Expand Down
2 changes: 1 addition & 1 deletion packages/@vuepress/theme-default/components/Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</template>

<script>
import { resolvePage, normalize, outboundRE, endingSlashRE } from '../layouts/util'
import { resolvePage, normalize, outboundRE, endingSlashRE } from '../util'
export default {
props: ['sidebarItems'],
Expand Down
2 changes: 1 addition & 1 deletion packages/@vuepress/theme-default/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import SidebarGroup from './SidebarGroup.vue'
import SidebarLink from './SidebarLink.vue'
import NavLinks from './NavLinks.vue'
import { isActive } from '../layouts/util'
import { isActive } from '../util'
export default {
components: { SidebarGroup, SidebarLink, NavLinks },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { isActive, hashRE, groupHeaders } from '../layouts/util'
import { isActive, hashRE, groupHeaders } from '../util'
export default {
functional: true,
Expand Down
22 changes: 18 additions & 4 deletions packages/@vuepress/theme-default/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
const themePlugin = require('./plugin')
const path = require('path')

// Theme API.
module.exports = {
module.exports = (options, ctx) => ({
alias () {
const { themeConfig, siteConfig } = ctx
// resolve algolia
const isAlgoliaSearch = (
themeConfig.algolia ||
Object.keys(siteConfig.locales && themeConfig.locales || {})
.some(base => themeConfig.locales[base].algolia)
)
return {
'@AlgoliaSearchBox': isAlgoliaSearch
? path.resolve(__dirname, 'src/AlgoliaSearchBox.vue')
: path.resolve(__dirname, 'noopModule.js')
}
},

plugins: [
themePlugin,
'@vuepress/active-header-links',
'@vuepress/search'
]
}
})
2 changes: 1 addition & 1 deletion packages/@vuepress/theme-default/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import Home from '../components/Home.vue'
import Navbar from '../components/Navbar.vue'
import Page from '../components/Page.vue'
import Sidebar from '../components/Sidebar.vue'
import { resolveSidebarItems } from './util'
import { resolveSidebarItems } from '../util'
export default {
components: { Home, Page, Sidebar, Navbar },
Expand Down
23 changes: 0 additions & 23 deletions packages/@vuepress/theme-default/plugin.js

This file was deleted.

0 comments on commit e231744

Please sign in to comment.