aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xwebpack.mix.js59
1 files changed, 57 insertions, 2 deletions
diff --git a/webpack.mix.js b/webpack.mix.js
index 54a2883..36d9f82 100755
--- a/webpack.mix.js
+++ b/webpack.mix.js
@@ -1,4 +1,5 @@
let mix = require('laravel-mix');
+let SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
/*
|--------------------------------------------------------------------------
@@ -12,15 +13,18 @@ let mix = require('laravel-mix');
*/
mix.js('resources/assets/js/app.js', 'public/js')
+ .js('resources/assets/js/admin.js', 'public/js')
.js('resources/assets/js/initial_key_gen.js', 'public/js')
+ .sass('resources/assets/sass/admin.scss', 'public/css')
.sass('resources/assets/sass/app.scss', 'public/css')
.sourceMaps()
.browserSync({
files: [
'public/css/*.css',
'public/js/*.js',
- '**/*.blade.php'
+ //'**/*.blade.php'
],
+ notify: false,
injectChanges: true,
proxy: {
target: '127.0.0.1:8000',
@@ -31,4 +35,55 @@ mix.js('resources/assets/js/app.js', 'public/js')
}
}
})
- .disableNotifications(); \ No newline at end of file
+ .disableNotifications().webpackConfig({
+ plugins: [
+ new SWPrecacheWebpackPlugin({
+ cacheId: 'BEAM-Messenger',
+ filename: 'service-worker.js',
+ staticFileGlobs: [
+ 'public/**/*.{css,js,eot,svg,ttf,woff,woff2,html}', // all compiled/public scripts
+ ],
+ minify: true,
+ stripPrefix: 'public/',
+ handleFetch: true,
+ maximumFileSizeToCacheInBytes: 20971520,
+ // dynamicUrlToDependencies: {
+ // '/': ['resources/views/writeMessage.blade.php'],
+ // '/profile': ['resources/views/profile.blade.php'],
+ // // TODO: add more for even better caching => ??
+ // },
+ staticFileGlobsIgnorePatterns: [/\.map$/, /mix-manifest\.json$/, /manifest\.json$/],
+ navigateFallback: '/',
+ importScripts: ['js/service-worker-ext.js'],
+ runtimeCaching: [{
+ urlPattern: /^https:\/\/fonts\.googleapis\.com\//,
+ handler: 'cacheFirst'
+ },
+ {
+ urlPattern: /^https:\/\/fonts\.gstatic\.com\//,
+ handler: 'cacheFirst'
+ },
+ {
+ urlPattern: /^https:\/\/cdn\.socket\.io\//,
+ handler: 'cacheFirst'
+ },
+ {
+ urlPattern: /\/socket.io\//,
+ handler: 'cacheFirst'
+ },
+ {
+ urlPattern: /\/_debugbar\//,
+ handler: 'cacheFirst'
+ },
+ {
+ urlPattern: /\/browser-sync\//,
+ handler: 'cacheFirst'
+ },
+ {
+ urlPattern: /\/avatar\//,
+ handler: 'cacheFirst'
+ }
+ ],
+ })
+ ]
+ }); \ No newline at end of file