Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit 1100fcf

Browse files
chore: send caching headers and use display swap for GF (#79)
1 parent 276b4fb commit 1100fcf

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

netlify/_headers

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
Referrer-Policy: origin
3+
X-Content-Type-Options: nosniff
4+
X-Frame-Options: DENY
5+
X-XSS-Protection: 1; mode=block
6+
7+
/assets/*
8+
Cache-Control: public, max-age=31536000, immutable
9+
10+
/sw.js
11+
Cache-Control: no-cache
File renamed without changes.

nuxt.config.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import path from 'path'
2-
import fs from 'fs'
1+
import { resolve } from 'path'
2+
import { promises } from 'fs'
33
import { colors } from './tailwind.js'
44
import i18n from './i18n'
55

@@ -98,8 +98,10 @@ export default {
9898
},
9999

100100
hooks: {
101-
'generate:distCopied' () {
102-
fs.copyFileSync(path.resolve(__dirname, './_redirects'), path.resolve(__dirname, './dist/_redirects'))
101+
async 'generate:distCopied' () {
102+
const copyFile = fileName => promises.copyFile(resolve(__dirname, 'netlify', fileName), resolve(__dirname, 'dist', fileName))
103+
const files = ['_redirects', '_headers']
104+
await Promise.all(files.map(copyFile))
103105
}
104106
},
105107

@@ -162,7 +164,7 @@ export default {
162164

163165
webfontloader: {
164166
google: {
165-
families: ['Lato:400,700']
167+
families: ['Lato:400,700&display=swap']
166168
}
167169
},
168170

@@ -221,9 +223,10 @@ export default {
221223
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[name]-[hash:7].[ext]',
222224
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[name]-[hash:7].[ext]'
223225
},
226+
publicPath: '/assets/',
224227
postcss: {
225228
plugins: {
226-
tailwindcss: path.resolve(__dirname, './tailwind.js'),
229+
tailwindcss: resolve(__dirname, './tailwind.js'),
227230
'postcss-nested': {}
228231
}
229232
},

0 commit comments

Comments
 (0)