mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -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'
|
import pkg from './package'
|
||||||
|
|
||||||
|
|
||||||
|
const removeAllScripts = html => html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
target: 'static',
|
target: 'static',
|
||||||
|
|
||||||
|
|
@ -17,6 +19,14 @@ export default {
|
||||||
* https://nuxtjs.org/api/configuration-hooks/
|
* https://nuxtjs.org/api/configuration-hooks/
|
||||||
*/
|
*/
|
||||||
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: {
|
// build: {
|
||||||
// before: storeAppLists
|
// before: storeAppLists
|
||||||
// },
|
// },
|
||||||
|
|
@ -165,7 +175,7 @@ export default {
|
||||||
|
|
||||||
|
|
||||||
// Always run
|
// Always run
|
||||||
|
|
||||||
// Push meta import rule for zip.js
|
// Push meta import rule for zip.js
|
||||||
config.module.rules.push({
|
config.module.rules.push({
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue