Skip to content
This repository was archived by the owner on May 3, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions template/build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var
ExtractTextPlugin = require('extract-text-webpack-plugin'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
SWPrecachePlugin = require('sw-precache-webpack-plugin')

module.exports = merge(baseWebpackConfig, {
module: {
Expand Down Expand Up @@ -70,6 +71,29 @@ module.exports = merge(baseWebpackConfig, {
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
chunks: ['vendor']
}),
// auto generate service-worker for caching static files
new SWPrecachePlugin({
cacheId: 'quasar-app',
filename: 'service-worker-cache.js',
minify: true,

staticFileGlobs: [
'js/**.js',
'fonts/**.woff',
'statics/*',
'/**.html',
'/**.css'
],

runtimeCaching: [{
urlPattern: /\/.*/,
handler: 'cacheFirst'
}],

dontCacheBustUrlsMatching: /./,
navigateFallback: '/'

})
]
})
1 change: 1 addition & 0 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"moment": "^2.15.0",
"quasar-framework": "^0.13.4",
"roboto-fontface": "^0.7.0",
"sw-precache-webpack-plugin": "^0.11.0",
"vue": "^2.3.0",
"vue-router": "^2.0.0"
},
Expand Down
8 changes: 7 additions & 1 deletion template/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">

<link rel="manifest" href="statics/manifest.json">
<title>Quasar App</title>
<link rel="shortcut icon" type="image/x-icon" href="statics/favicon.ico">
<script>
// activate service worker
if('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker-cache.js');
}
</script>
</head>
<body>
<div id="q-app"></div>
Expand Down
Binary file added template/src/statics/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions template/src/statics/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"lang": "en",
"background_color": "#0273D4",
"theme_color": "#0273D4",
"name": "Your app name",
"short_name": "myApp",
"display": "standalone",
"start_url": "index.html",
"icons": [
{
"src": "statics/logo.png",
"sizes": "144x144",
"type": "image/png"
}
],
"orientation": "portrait"
}