File tree 8 files changed +17
-10
lines changed
8 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 2
2
node_modules
3
3
* .log
4
4
.temp
5
- docs / . vuepress/ dist
5
+ vuepress
6
6
TODOs.md
Original file line number Diff line number Diff line change 1
1
module . exports = {
2
- data : {
3
- title : 'VuePress'
4
- }
2
+ base : '/vuepress/' ,
3
+ title : 'VuePress' ,
4
+ dest : 'vuepress'
5
5
}
Original file line number Diff line number Diff line change 1
1
# VuePress
2
2
3
- ![ logo] ( /logo.png )
4
-
5
3
> Minimalistic docs generator with Vue component based layout system
Original file line number Diff line number Diff line change 2
2
3
3
## ` .vuepress/config.js `
4
4
5
- ### baseUrl
5
+ ### base
6
+
7
+ ### title
6
8
7
9
### head
8
10
Original file line number Diff line number Diff line change @@ -45,3 +45,7 @@ var vm = new Vue({
45
45
46
46
- Foo is {{ $page.frontmatter.foo }}
47
47
- Bar is {{ $page.frontmatter.bar }}
48
+
49
+ ## Using Site Data
50
+
51
+ <img :src =" `${$site.base}logo.png` " alt =" logo " >
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import metadataMixin from './metadataMixin'
9
9
// async components;
10
10
// 2. exports siteData
11
11
// 3. exports routes
12
- import { routes } from './.temp/siteData'
12
+ import { routes , siteData } from './.temp/siteData'
13
13
14
14
Vue . use ( Router )
15
15
@@ -27,6 +27,7 @@ routes.push({
27
27
28
28
export function createApp ( ) {
29
29
const router = new Router ( {
30
+ base : siteData . base ,
30
31
mode : 'history' ,
31
32
fallback : false ,
32
33
routes
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ async function resolveOptions (sourceDir) {
49
49
outDir : siteConfig . dest
50
50
? path . resolve ( siteConfig . dest )
51
51
: path . resolve ( sourceDir , '.vuepress/dist' ) ,
52
- publicPath : siteConfig . baseUrl || '/' ,
52
+ publicPath : siteConfig . base || '/' ,
53
53
pageFiles : await globby ( [ '**/*.md' , '!.vuepress' ] , { cwd : sourceDir } )
54
54
}
55
55
@@ -110,6 +110,8 @@ async function resolveOptions (sourceDir) {
110
110
111
111
// resolve site data
112
112
options . siteData = Object . assign ( { } , siteConfig . data , {
113
+ title : siteConfig . title ,
114
+ base : siteConfig . base || '/' ,
113
115
pages : pagesData
114
116
} )
115
117
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ module.exports = function createBaseConfig ({
23
23
. output
24
24
. path ( outDir )
25
25
. filename ( isProd ? '_assets/js/[name].[chunkhash:8].js' : '_assets/js/[name].js' )
26
- . publicPath ( publicPath )
26
+ . publicPath ( isProd ? publicPath : '/' )
27
27
28
28
config . resolve
29
29
. set ( 'symlinks' , true )
You can’t perform that action at this time.
0 commit comments