-
Notifications
You must be signed in to change notification settings - Fork 67
/
vue.config.js
64 lines (60 loc) · 1.74 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const { gitDescribeSync } = require('git-describe');
const hljs = require('highlight.js/lib/core');
const config = require('./config.json');
process.env.VUE_APP_GIT_HASH = gitDescribeSync().hash;
const hljsLanguages = [
'java', ['yaml', 'yml'], ['ini', 'toml'],
'json', 'sql', 'gradle', 'bash', 'xml',
'nginx', ['plaintext', 'hocon', 'conf'],
];
function registerHljsLanguages() {
for (let lang of hljsLanguages) {
lang = [].concat(lang);
const mod = require(`highlight.js/lib/languages/${lang[0]}`);
for (const alias of lang) {
hljs.registerLanguage(alias, mod);
}
}
}
module.exports = {
publicPath: config.base,
css: {
loaderOptions: {
sass: {
additionalData: `
@use "sass:color";
@import "@/scss/variables.scss";
@import "@/scss/breakpoints.scss";
`,
},
},
},
chainWebpack: (webpackConfig) => {
registerHljsLanguages();
webpackConfig.module
.rule('md')
.test(/\.md$/)
.use('vue-loader')
.loader('vue-loader')
.end()
.use('@lucko/vue-markdown-loader')
.loader('@lucko/vue-markdown-loader/lib/markdown-compiler')
.options({
raw: true,
linkify: false,
use: [
// eslint-disable-next-line global-require
[require('markdown-it-anchor'), {
permalink: true,
permalinkSymbol: '🔗',
slugify: s => String(s).trim().toLowerCase().replace(/\s+/g, '-')
.replace(/([^\w-]+)/g, ''),
}],
// eslint-disable-next-line global-require
require('markdown-it-emoji'),
// eslint-disable-next-line global-require
[require('markdown-it-highlightjs'), { hljs }],
],
});
},
};