Skip to content

Commit

Permalink
chore: support pwa
Browse files Browse the repository at this point in the history
  • Loading branch information
ErKeLost committed Dec 17, 2022
1 parent 17e47cd commit bd4d8e5
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/vite-cli/template/react/public/_headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/assets/*
cache-control: max-age=31536000
cache-control: immutable
3 changes: 3 additions & 0 deletions packages/vite-cli/template/react/public/favicon-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
3 changes: 3 additions & 0 deletions packages/vite-cli/template/react/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion packages/vite-cli/template/react/public/vite.svg

This file was deleted.

28 changes: 28 additions & 0 deletions packages/vite-cli/template/vue/build/vite/plugin.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Plugin } from 'vite'
import vue from "@vitejs/plugin-vue"
import { VitePWA } from 'vite-plugin-pwa'
<%- pluginImportStatement %>
<% if (components === 'vuetify') { -%>
import vuetify from 'vite-plugin-vuetify'
Expand All @@ -15,6 +16,33 @@ export function createVitePlugins(viteEnv, isDev: boolean) {
vue({
reactivityTransform: true
}),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.svg', 'safari-pinned-tab.svg'],
manifest: {
name: 'ViteTemplate',
short_name: 'ViteTemplate',
theme_color: '#ffffff',
icons: [
{
src: '/pwa-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: '/pwa-512x512.png',
sizes: '512x512',
type: 'image/png'
},
{
src: '/pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable'
}
]
}
})
<% if (plugins.indexOf('jsx') !== -1) { -%>
VueJsx(),
<% } -%>
Expand Down
6 changes: 6 additions & 0 deletions packages/vite-cli/template/vue/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="apple-touch-icon" href="/pwa-192x192.png" />
<meta name="msapplication-TileColor" content="#00aba9" />
<meta
http-equiv="Content-Security-Policy"
content="upgrade-insecure-requests"
/>
<% if (plugins.indexOf('html') !== -1) { -%>
<title>title</title>
<% } -%>
Expand Down
3 changes: 3 additions & 0 deletions packages/vite-cli/template/vue/public/_headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/assets/*
cache-control: max-age=31536000
cache-control: immutable
3 changes: 3 additions & 0 deletions packages/vite-cli/template/vue/public/favicon-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/vite-cli/template/vue/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bd4d8e5

Please sign in to comment.