Skip to content

Instantly share code, notes, and snippets.

@RemeJuan
Last active July 14, 2017 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RemeJuan/14f7012a593c0ae3550ed7df5009315c to your computer and use it in GitHub Desktop.
Save RemeJuan/14f7012a593c0ae3550ed7df5009315c to your computer and use it in GitHub Desktop.
PWA: Webpack
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const WebpackPwaManifest = require('webpack-pwa-manifest');
const PUBLIC_PATH = 'https://www.remelehane.me/';
module: {
// Snip
plugins: [
// Snip
new SWPrecacheWebpackPlugin(
{
cacheId: 'remelehane',
dontCacheBustUrlsMatching: /\.\w{8}\./,
filename: 'service-worker.js',
minify: true,
navigateFallback: PUBLIC_PATH + 'index.html',
staticFileGlobsIgnorePatterns: [/\.map$/, /manifest\.json$/]
}
),
new WebpackPwaManifest({
name: 'Reme Le Hane: Portfolio',
short_name: 'RLH',
description: 'My Personal Portfolio!',
background_color: '#01579b',
theme_color: '#01579b',
'theme-color': '#01579b',
start_url: '/',
icons: [
{
src: path.resolve('src/assets/images/RTMS-Icon.png'),
sizes: [96, 128, 192, 256, 384, 512],
destination: path.join('assets', 'icons')
}
]
})
],
output: {
path: path.join(process.cwd(), conf.paths.dist),
filename: '[name]-[hash].js',
publicPath: PUBLIC_PATH
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment