-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnuxt.config.js
executable file
·86 lines (85 loc) · 2.33 KB
/
nuxt.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const Config = require('./config')
let PWAIcons = [16, 120, 144, 152, 192, 384, 512].map(size => {
return {
src: `${Config.CDN}icon_${size}.png`,
sizes: `${size}x${size}`,
type: 'image/png'
}
})
module.exports = {
/*
** Headers of the page
*/
cache: {
max: 1000,
maxAge: 900000
},
router: {
// 在每页渲染前运行 middleware/user-agent.js 中间件的逻辑
middleware: ['auth', 'i18n', 'notification'],
scrollBehavior: function (to, from, savedPosition) {
return { x: 0, y: 0 }
}
},
head: {
title: '前端情报局',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' },
{ hid: 'description', name: 'description', content: '前端最新新闻,最新框架发布,小知识点最新前端资讯和情报' },
{hid: 'keywords', name: 'keywords', content: '前端,情报,小知识'}
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
/*
** Global CSS
*/
css: [
'bootstrap/dist/css/bootstrap.css',
'prismjs/themes/prism.css',
'animate.css',
'~/assets/css/main.css'
],
modules: [
// Simple usage
'@nuxtjs/workbox',
'@nuxtjs/manifest'
],
manifest: {
name: '前端情报局',
short_name: '前端情报',
display: 'standalone',
start_url: 'https://news.awesomes.cn/',
theme_color: '#da552f',
background_color: '#FFF',
lang: 'zh-CN',
icons: PWAIcons
},
/*
** Customize the progress-bar color
*/
loading: { color: '#da552f' },
/*
** Build configuration
*/
build: {
vendor: ['vue-i18n', 'babel-polyfill'],
publicPath: `${Config.CDN}.nuxt/dist/`,
/*
** Run ESLINT on save
*/
extend (config, ctx) {
if (ctx.isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
},
plugins: ['~/plugins/vue-icon', '~/plugins/icon', '~/plugins/common', { src: '~/plugins/ba.js', ssr: false }, { src: '~/plugins/pagination.js', ssr: false }, { src: '~/plugins/upload', ssr: false }, { src: '~/plugins/i18n.js', injectAs: 'i18n' }]
}