-
Notifications
You must be signed in to change notification settings - Fork 2
/
gridsome.config.js
152 lines (142 loc) · 4.38 KB
/
gridsome.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// This is where project configuration and plugin options are located.
// Learn more: https://gridsome.org/docs/config
// Changes here require a server restart.
// To restart press CTRL + C in terminal and run `gridsome develop`
const path = require('path')
function addStyleResource(rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, './src/assets/scss/_vars-override.scss'),
path.resolve(__dirname, './src/assets/scss/_vars.scss'),
path.resolve(__dirname, './src/assets/scss/_mixins.scss'),
path.resolve(__dirname, './node_modules/bootstrap/scss/_functions.scss'),
path.resolve(__dirname, './node_modules/bootstrap/scss/_variables.scss'),
path.resolve(__dirname, './node_modules/bootstrap/scss/_mixins.scss'),
],
})
}
// TODO: Use env?
const siteName = 'Portfolio'
const siteDescription = 'Un exemple de portfolio réalisé avec Gridsome.'
const favicon = 'src/assets/img/favicon.png'
module.exports = {
siteName,
siteDescription,
// TODO: Use env
siteUrl: 'https://example.com',
icon: {
favicon,
},
transformers: {
remark: {
externalLinksTarget: '_blank',
externalLinksRel: ['nofollow', 'noopener', 'noreferrer'],
anchorClassName: 'icon icon-link',
plugins: [
// ...global plugins
],
},
},
plugins: [
{
use: 'gridsome-plugin-pwa',
options: {
title: siteName,
description: siteDescription,
themeColor: '#00835c',
backgroundColor: '#ffffff',
icon: favicon,
lang: 'fr',
maskableIcon: true,
},
},
{
use: '@gridsome/source-filesystem',
options: {
typeName: 'PortfolioItem',
baseDir: './content/portfolio-items',
path: '*.md',
},
},
{
use: '@gridsome/source-filesystem',
options: {
typeName: 'Category',
baseDir: './content/categories',
path: '*.md',
},
},
{
use: '@gridsome/source-filesystem',
options: {
typeName: 'Technology',
baseDir: './content/technologies',
path: '*.md',
},
},
{
use: '@gridsome/source-filesystem',
options: {
typeName: 'Block',
baseDir: './content/blocks',
path: '*.md',
},
},
{
use: 'gridsome-plugin-netlify-cms',
options: {
configPath: 'src/admin/config.yml',
htmlTitle: 'Portfolio CMS',
modulePath: 'src/admin/index.js',
publicPath: '/admin',
},
},
{
use: 'gridsome-plugin-i18n',
options: {
locales: [
'fr',
],
defaultLocale: 'fr',
fallbackLocale: 'fr',
rewriteDefaultLanguage: false,
messages: {
// Messages are declared in main.js
// See https://github.com/daaru00/gridsome-plugin-i18n#hot-reload
},
},
},
{
use: '@gridsome/plugin-critical',
options: {
paths: ['/'],
width: 1920,
height: 1080,
},
},
{
use: 'gridsome-plugin-netlify-cms-paths',
options: {
contentTypes: ['PortfolioItem', 'Technology', 'Category'],
coverField: 'coverImage',
},
},
],
templates: {
PortfolioItem: [
{
path: '/portfolio/:title',
component: './src/templates/PortfolioItem.vue',
},
],
},
chainWebpack(config) {
// Load variables for all vue-files
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => {
addStyleResource(config.module.rule('scss').oneOf(type))
})
},
}