-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.js
170 lines (158 loc) · 4.39 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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import { readdirSync, writeFileSync } from 'fs'
import { siteName } from './shop.public.config.js'
import en from './locales/en.json'
// import fr from './locales/fr.json'
const isDev = process.env.NODE_ENV !== 'production'
// In each product images directory,
// create a json file with a list of image file names
function createProductImageManifests () {
const productImagesDir = './static/product-images'
const productImagesManifestFilename = 'manifest.json'
const getDirectories = source =>
readdirSync(source, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name)
getDirectories(productImagesDir).forEach((dir) => {
const images = readdirSync(`${productImagesDir}/${dir}`)
.filter(file => !file.includes(productImagesManifestFilename))
writeFileSync(`${productImagesDir}/${dir}/${productImagesManifestFilename}`, JSON.stringify(images))
})
}
export default {
/*
** Nuxt rendering mode
** See https://nuxtjs.org/api/configuration-mode
*/
mode: 'spa',
/*
** Nuxt target
** See https://nuxtjs.org/api/configuration-target
*/
target: 'static',
/*
** Headers of the page
** See https://nuxtjs.org/api/configuration-head
*/
fetchOnServer: false,
head: {
title: siteName,
titleTemplate: `%s - ${siteName}`,
htmlAttrs: {
lang: () => this.i18n.locale
},
script: [
{ src: 'https://js.stripe.com/v3/', defer: true }
],
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ name: 'description', content: 'Original mask designs made in Montreal. Made from machine cut, hand-shaped and assembled acrylic plastic.' }
],
link: [
{ rel: 'apple-touch-icon', sizes: '76x76', href: '/apple-touch-icon.png' },
{ rel: 'icon', type: 'image/png', sizes: '32x32', href: '/favicon-32x32.png' },
{ rel: 'icon', type: 'image/png', sizes: '16x16', href: '/favicon-16x16.png' },
{ rel: 'manifest', href: '/site.webmanifest' },
{ rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#ed0064' },
{ rel: 'preconnect', href: 'https://fonts.googleapis.com/' }
]
},
publicRuntimeConfig: {
url: isDev ? 'http://localhost:3000' : '',
// NETLIFY_FUNCTIONS_BASE_URL: process.env.NETLIFY_FUNCTIONS_BASE_URL,
// STRIPE_API_VERSION: process.env.STRIPE_API_VERSION,
STRIPE_IS_LIVE_MODE: process.env.STRIPE_IS_LIVE_MODE,
STRIPE_PUBLISHABLE_KEY_TEST: process.env.STRIPE_PUBLISHABLE_KEY_TEST,
STRIPE_PUBLISHABLE_KEY_LIVE: process.env.STRIPE_PUBLISHABLE_KEY_LIVE
},
// privateRuntimeConfig: {
// STRIPE_SECRET_TEST_KEY: process.env.STRIPE_SECRET_TEST_KEY,
// STRIPE_SECRET_LIVE_KEY: process.env.STRIPE_SECRET_LIVE_KEY
// },
/*
** Plugins to load before mounting the App
** https://nuxtjs.org/guide/plugins
*/
plugins: [
{ src: '~/plugins/nuxt-client-init.js', ssr: false }
],
/*
** Auto import components
** See https://nuxtjs.org/api/configuration-components
*/
components: true,
/*
** Nuxt.js dev-modules
*/
buildModules: [
// Doc: https://github.com/nuxt-community/eslint-module
// '@aceforth/nuxt-netlify',
'@nuxtjs/eslint-module',
'@nuxtjs/style-resources',
'nuxt-purgecss'
],
/*
** Nuxt.js modules
*/
modules: [
['nuxt-i18n', {
injectAs: 'i18n',
locales: [
{
code: 'en',
iso: 'en-US',
name: 'English'
}
// {
// code: 'fr',
// iso: 'fr-CA',
// name: 'français'
// }
],
vueI18n: {
messages: {
en
// fr
},
fallbackLocale: 'en',
silentTranslationWarn: true
},
defaultLocale: 'en',
noPrefixDefaultLocale: true
}],
'nuxt-webfontloader'
],
styleResources: {
sass: './assets/sass/variables.sass'
},
css: [
'~/assets/sass/bulma.sass'
],
// loading: { color: '#ed0064' },
loading: false,
/*
** Build configuration
** See https://nuxtjs.org/api/configuration-build/
*/
build: {
// postcss: {
// preset: {
// features: {
// customProperties: false
// }
// }
// },
extend (config, { isServer }) {
if (isServer) {
createProductImageManifests()
}
}
},
netlify: {
},
webfontloader: {
google: {
families: ['Rubik:400,400i,500']
}
}
}