-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
48 lines (48 loc) · 1.71 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var md = require('markdown-it-container')
const mIt = require('markdown-it-decorate')
module.exports = {
publicPath: './',
outputDir: './example/dist',
configureWebpack: {
entry: './example/main.js',
externals: {
Vue: 'Vue',
'vue-router': 'VueRouter'
}
},
chainWebpack: config => {
config.module.rule('md')
.test(/\.md/)
.use('vue-loader')
.loader('vue-loader')
.end()
.use('vue-markdown-loader')
.loader('vue-markdown-loader/lib/markdown-compiler')
.options({
raw: true,
use: [
[
md,
'demo',
{
validate(params) {
return params.trim().match(/^demo\s*(.*)$/)
},
render(tokens, idx) {
if (tokens[idx].nesting === 1) {
const content = tokens[idx + 1].type === 'fence' ? tokens[idx + 1].content : '';
return `<demo-block>
<div class="source" slot="source">${content}</div>
<div class="code" slot="highlight">`;
} else {
// closing tag
return '</div></demo-block>\n';
}
}
}
],
[mIt]
]
})
}
}