-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(service-worker): add sw-precache for offline
- Loading branch information
Showing
4 changed files
with
200 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -13,12 +13,18 @@ | |
"node": ">=8.1", | ||
"npm": ">= 5" | ||
}, | ||
"browserslist": [ | ||
"last 2 versions", | ||
"not ie <= 10", | ||
"not ie_mob <= 10" | ||
], | ||
"scripts": { | ||
"build": "ng build --prod", | ||
"e2e": "ng e2e", | ||
"lint": "ng lint", | ||
"ng": "ng", | ||
"prebuild": "ng lint", | ||
"postbuild": "npm run precache", | ||
"precache": "sw-precache --config=sw-precache.config.js --verbose", | ||
"start": "ng serve", | ||
"test": "ng test" | ||
}, | ||
|
@@ -57,8 +63,35 @@ | |
"karma-jasmine-html-reporter": "^0.2.2", | ||
"minx": "r-park/minx.git", | ||
"protractor": "^5.1.2", | ||
"sw-precache": "^5.2.0", | ||
"ts-node": "^3.2.0", | ||
"tslint": "^5.5.0", | ||
"typescript": "^2.4.1" | ||
} | ||
}, | ||
"author": { | ||
"name": "Richard Park", | ||
"email": "[email protected]" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Cody Lundquist", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Jason Shultz", | ||
"email": "" | ||
}, | ||
{ | ||
"name": "Luke Schlangen", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Sinan Bolel", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Yannick Koehler", | ||
"email": "[email protected]" | ||
} | ||
] | ||
} |
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,31 @@ | ||
module.exports = { | ||
navigateFallback: '/index.html', | ||
|
||
// @see https://github.com/Polymer/polymer-build/issues/35 | ||
navigateFallbackWhitelist: [ | ||
/^(?!\/__)/ | ||
], | ||
|
||
root: 'dist', | ||
runtimeCaching: [ | ||
{ | ||
urlPattern: /^https:\/\/fonts\.googleapis\.com\//, | ||
handler: 'cacheFirst' | ||
}, | ||
{ | ||
urlPattern: /^https:\/\/maxcdn\.bootstrapcdn\.com\//, | ||
handler: 'cacheFirst' | ||
}, | ||
{ | ||
urlPattern: /^https:\/\/use\.typekit\.net\//, | ||
handler: 'cacheFirst' | ||
} | ||
], | ||
staticFileGlobs: [ | ||
'dist/assets/**/*', | ||
'dist/*.css', | ||
'dist/*.html', | ||
'dist/*.js' | ||
], | ||
stripPrefix: 'dist/' | ||
}; |