-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: add experimental PWA assets generation and injection (#117)
* feat!: add experimental PWA assets generation and injection * chore: add `playground-assets` for pwa assets * chore: update playground-assets * chore: update pwa plugin version * chore: include layout in assets playground
- Loading branch information
Showing
35 changed files
with
1,359 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<template> | ||
<NuxtLoadingIndicator /> | ||
<NuxtLayout> | ||
<NuxtPage /> | ||
</NuxtLayout> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<template> | ||
<div> | ||
<NuxtPwaAssets /> | ||
<slot /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import process from 'node:process' | ||
|
||
const sw = process.env.SW === 'true' | ||
|
||
export default defineNuxtConfig({ | ||
/* ssr: false, */ | ||
// typescript, | ||
modules: ['@vite-pwa/nuxt'], | ||
future: { | ||
typescriptBundlerResolution: true, | ||
}, | ||
experimental: { | ||
payloadExtraction: true, | ||
watcher: 'parcel', | ||
}, | ||
nitro: { | ||
esbuild: { | ||
options: { | ||
target: 'esnext', | ||
}, | ||
}, | ||
prerender: { | ||
routes: ['/', '/about'], | ||
}, | ||
}, | ||
imports: { | ||
autoImport: true, | ||
}, | ||
appConfig: { | ||
// you don't need to include this: only for testing purposes | ||
buildDate: new Date().toISOString(), | ||
}, | ||
vite: { | ||
logLevel: 'info', | ||
}, | ||
pwa: { | ||
mode: 'development', | ||
strategies: 'generateSW', | ||
registerType: 'autoUpdate', | ||
manifest: { | ||
name: 'Nuxt Vite PWA', | ||
short_name: 'NuxtVitePWA', | ||
theme_color: '#ffffff', | ||
}, | ||
pwaAssets: { | ||
config: true, | ||
}, | ||
workbox: { | ||
globPatterns: ['**/*.{js,css,html,png,svg,ico}'], | ||
}, | ||
client: { | ||
installPrompt: true, | ||
}, | ||
devOptions: { | ||
enabled: true, | ||
suppressWarnings: true, | ||
navigateFallback: '/', | ||
navigateFallbackAllowlist: [/^\/$/], | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "playground-assets", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"dev": "nuxi dev", | ||
"build": "nuxi build", | ||
"generate": "nuxi generate" | ||
}, | ||
"devDependencies": { | ||
"@vite-pwa/assets-generator": "^0.2.4", | ||
"@vite-pwa/nuxt": "workspace:*", | ||
"nuxt": "^3.10.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script setup lang="ts"> | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<h1>Nuxt Vite PWA</h1> | ||
<ClientOnly> | ||
PWA Installed: {{ $pwa?.isPWAInstalled }} | ||
</ClientOnly> | ||
<br> | ||
<NuxtLink to="/"> | ||
Home | ||
</NuxtLink> | ||
<br> | ||
<PwaTransparentImage image="pwa-192x192.png" alt="PWA Icon" /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script setup lang="ts"> | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<h1>Nuxt Vite PWA</h1> | ||
<ClientOnly> | ||
PWA Installed: {{ $pwa?.isPWAInstalled }} | ||
</ClientOnly> | ||
<br> | ||
<NuxtLink to="/about"> | ||
About | ||
</NuxtLink> | ||
<br> | ||
<PwaTransparentImage image="pwa-64x64.png" alt="PWA Icon" /> | ||
</div> | ||
</template> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { | ||
createAppleSplashScreens, | ||
defineConfig, | ||
minimal2023Preset, | ||
} from '@vite-pwa/assets-generator/config' | ||
|
||
export default defineConfig({ | ||
headLinkOptions: { | ||
preset: '2023', | ||
}, | ||
preset: { | ||
...minimal2023Preset, | ||
appleSplashScreens: createAppleSplashScreens({ | ||
padding: 0.3, | ||
resizeOptions: { fit: 'contain', background: 'white' }, | ||
darkResizeOptions: { fit: 'contain', background: 'black' }, | ||
linkMediaOptions: { | ||
log: true, | ||
addMediaScreen: true, | ||
xhtml: true, | ||
}, | ||
}, ['iPad Air 9.7"']), | ||
}, | ||
images: 'public/favicon.svg', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "./.nuxt/tsconfig.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "my-module-playground", | ||
"name": "playground", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
|
Oops, something went wrong.