Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Mastodon
Commits
0692991b
Commit
0692991b
authored
7 years ago
by
Nolan Lawson
Committed by
Eugen Rochko
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add ServiceWorker caching for static assets (#5524)
parent
6705463e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/views/home/index.html.haml
+0
-2
0 additions, 2 deletions
app/views/home/index.html.haml
config/webpack/production.js
+31
-1
31 additions, 1 deletion
config/webpack/production.js
with
31 additions
and
3 deletions
app/views/home/index.html.haml
+
0
−
2
View file @
0692991b
...
...
@@ -3,8 +3,6 @@
%link
{
href:
asset_pack_path
(
'features/compose.js'
),
crossorigin:
'anonymous'
,
rel:
'preload'
,
as:
'script'
}
/
%link
{
href:
asset_pack_path
(
'features/home_timeline.js'
),
crossorigin:
'anonymous'
,
rel:
'preload'
,
as:
'script'
}
/
%link
{
href:
asset_pack_path
(
'features/notifications.js'
),
crossorigin:
'anonymous'
,
rel:
'preload'
,
as:
'script'
}
/
%link
{
href:
asset_pack_path
(
'features/community_timeline.js'
),
crossorigin:
'anonymous'
,
rel:
'preload'
,
as:
'script'
}
/
%link
{
href:
asset_pack_path
(
'features/public_timeline.js'
),
crossorigin:
'anonymous'
,
rel:
'preload'
,
as:
'script'
}
/
%meta
{
name:
'applicationServerKey'
,
content:
Rails
.
configuration
.
x
.
vapid_public_key
}
%script
#initial-state
{
type:
'application/json'
}!=
json_escape
(
@initial_state_json
)
...
...
This diff is collapsed.
Click to expand it.
config/webpack/production.js
+
31
−
1
View file @
0692991b
...
...
@@ -48,7 +48,37 @@ module.exports = merge(sharedConfig, {
}),
new
OfflinePlugin
({
publicPath
:
publicPath
,
// sw.js must be served from the root to avoid scope issues
caches
:
{
},
// do not cache things, we only use it for push notifications for now
caches
:
{
main
:
[
'
:rest:
'
],
additional
:
[
'
:externals:
'
],
optional
:
[
'
**/locale_*.js
'
,
// don't fetch every locale; the user only needs one
'
**/*_polyfills-*.js
'
,
// the user may not need polyfills
'
**/*.woff2
'
,
// the user may have system-fonts enabled
// images/audio can be cached on-demand
'
**/*.png
'
,
'
**/*.jpg
'
,
'
**/*.jpeg
'
,
'
**/*.svg
'
,
'
**/*.mp3
'
,
'
**/*.ogg
'
,
],
},
externals
:
[
'
/emoji/1f602.svg
'
,
// used for emoji picker dropdown
'
/emoji/sheet.png
'
,
// used in emoji-mart
],
excludes
:
[
'
**/*.gz
'
,
'
**/*.map
'
,
'
stats.json
'
,
'
report.html
'
,
// any browser that supports ServiceWorker will support woff2
'
**/*.eot
'
,
'
**/*.ttf
'
,
'
**/*-webfont-*.svg
'
,
'
**/*.woff
'
,
],
ServiceWorker
:
{
entry
:
path
.
join
(
__dirname
,
'
../../app/javascript/mastodon/service_worker/entry.js
'
),
cacheName
:
'
mastodon
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment