mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Remove scripts from all pages
This commit is contained in:
parent
c602aa9de8
commit
7165f4db3c
1 changed files with 11 additions and 1 deletions
|
|
@ -3,6 +3,8 @@ import { promises as fs } from 'fs'
|
|||
import pkg from './package'
|
||||
|
||||
|
||||
const removeAllScripts = html => html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '')
|
||||
|
||||
export default {
|
||||
target: 'static',
|
||||
|
||||
|
|
@ -17,6 +19,14 @@ export default {
|
|||
* https://nuxtjs.org/api/configuration-hooks/
|
||||
*/
|
||||
hooks: {
|
||||
// This hook is called before generatic static html files for SPA mode
|
||||
'generate:page': (page) => {
|
||||
page.html = removeAllScripts(page.html)
|
||||
},
|
||||
// This hook is called before rendering the html to the browser
|
||||
'render:route': (url, page, { req, res }) => {
|
||||
page.html = removeAllScripts(page.html)
|
||||
}
|
||||
// build: {
|
||||
// before: storeAppLists
|
||||
// },
|
||||
|
|
@ -165,7 +175,7 @@ export default {
|
|||
|
||||
|
||||
// Always run
|
||||
|
||||
|
||||
// Push meta import rule for zip.js
|
||||
config.module.rules.push({
|
||||
test: /\.js$/,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue