Update local server + page generation
This commit is contained in:
parent
bb2388ddb9
commit
ccb046a08a
18
frontend/Caddyfile
Normal file
18
frontend/Caddyfile
Normal file
@ -0,0 +1,18 @@
|
||||
:7000
|
||||
|
||||
log {
|
||||
format single_field common_log
|
||||
}
|
||||
|
||||
encode gzip
|
||||
|
||||
root * dist
|
||||
file_server
|
||||
|
||||
try_files {path} /200.html
|
||||
|
||||
@nuxt {
|
||||
path /_nuxt/*
|
||||
}
|
||||
|
||||
header @nuxt Cache-Control "public,max-age=31536000,immutable" # 1 year
|
||||
@ -1,5 +1,3 @@
|
||||
import cheerio from 'cheerio'
|
||||
|
||||
export default ({ command }) => ({
|
||||
mode: 'universal',
|
||||
/*
|
||||
@ -100,9 +98,6 @@ export default ({ command }) => ({
|
||||
middleware: ['auth'],
|
||||
},
|
||||
|
||||
generate: {
|
||||
fallback: '404.html',
|
||||
},
|
||||
/*
|
||||
** Build configuration
|
||||
*/
|
||||
@ -155,16 +150,4 @@ export default ({ command }) => ({
|
||||
['font', 'script', 'style'].includes(asType),
|
||||
},
|
||||
},
|
||||
|
||||
hooks: {
|
||||
'generate:page': (page) => {
|
||||
const doc = cheerio.load(page.html)
|
||||
doc(`html`).removeAttr('data-n-head-ssr').removeAttr('data-n-head')
|
||||
doc(`head meta`).removeAttr('data-n-head').removeAttr('data-hid')
|
||||
doc(`head link`).removeAttr('data-n-head').removeAttr('data-hid')
|
||||
doc(`head style`).removeAttr('data-vue-ssr-id')
|
||||
doc(`#__nuxt`).removeAttr('data-server-rendered')
|
||||
page.html = doc.html()
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
"build": "nuxt build",
|
||||
"start": "nuxt start",
|
||||
"generate": "nuxt generate --modern",
|
||||
"serve": "caddy file-server --root dist --listen :7000 --access-log",
|
||||
"serve": "caddy run",
|
||||
"lint": "eslint --ext .js,.vue --ignore-path .gitignore ."
|
||||
},
|
||||
"dependencies": {
|
||||
@ -31,7 +31,6 @@
|
||||
"@nuxtjs/eslint-module": "^1.1.0",
|
||||
"@nuxtjs/tailwindcss": "^2.0.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"dotenv": "^8.2.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user