-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnuxt.config.js
More file actions
88 lines (80 loc) · 2.91 KB
/
nuxt.config.js
File metadata and controls
88 lines (80 loc) · 2.91 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const purgeCss = require('purgecss-webpack-plugin');
const purgeCssWhiteLister = require('purgecss-whitelister');
const glob = require('glob-all');
const path = require('path');
const config = require('./config');
const baseUrl = config.get('baseUrl');
const themeColor = config.get('themeColor');
const title = config.get('title');
const description = config.get('description');
const image = config.get('image');
const manifest = config.get('manifest');
let link = [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'image_src', href: baseUrl + image },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:400,700|Material+Icons' },
]
if (manifest) {
link.push({ rel: 'manifest', href: manifest });
}
const codemirrorCss = [
'./node_modules/codemirror/lib/codemirror.css',
'./node_modules/codemirror/theme/material.css',
];
module.exports = {
head: {
title: title,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width,initial-scale=1,maximum-scale=5' },
{ hid: 'description', name: 'description', content: description },
{ hid: 'twitter:card', property: 'twitter:card', content: 'summary' },
{ hid: 'og:image', property: 'og:image', content: baseUrl + (config.get('og:image') || image) },
{ hid: 'og:title', property: 'og:title', content: config.get('og:title') || title },
{ hid: 'og:description', property: 'og:description', content: config.get('og:description') || description },
{ name: 'theme-color', content: themeColor },
{ name: 'apple-mobile-web-app-status-bar-style', content: config.get('apple:color') || themeColor },
{ name: 'apple-mobile-web-app-title', content: config.get('apple:title') || title },
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
],
link: link,
},
loading: false,
env: {
baseUrl: baseUrl,
components: require('./components')
},
css: codemirrorCss.concat([
'~assets/scss/material-kit.scss',
]),
plugins: [
'~plugins/head',
{ src: '~plugins/bootstrap', ssr: false },
{ src: '~plugins/preview', ssr: false },
],
build: {
extractCSS: true,
extend (config, { isDev, isClient }) {
config.resolve.alias.vue = 'vue/dist/vue.js'
if (!isDev) {
const whitelist = purgeCssWhiteLister(codemirrorCss);
config.plugins.push(
new purgeCss({
paths: glob.sync([
path.join(__dirname, '**/*.vue'),
path.join(__dirname, 'node_modules/bootstrap-vue/es/components', '**/*.js')
]),
whitelist: whitelist.concat(['html', 'body', '.nav-open', '#bodyClick'])
})
)
} else if (isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
});
}
}
},
};