-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Discourse work while offline #7870
Conversation
You've signed the CLA, xfalcox. Thank you! This pull request is ready for review. |
@@ -1,117 +1,25 @@ | |||
'use strict'; | |||
|
|||
importScripts("<%= ::UrlHelper.absolute("/javascripts/workbox/workbox-sw.js") %>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple questions here:
-
Do we need all the included files below? It seems like quite a few and I suspect not all of them are used by this include. It's hard to tell though.
-
Can this be installed via
yarn
? We've moving other dependencies to that approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need all the included files below? It seems like quite a few and I suspect not all of them are used by this include. It's hard to tell though.
No, currently we don't use all of those files.
What I did was I got the WorkboxJS release, and extracted all the contents to public/javascripts/workbox/
, kinda like we do with Ace.
In the code we import the main file /javascripts/workbox/workbox-sw.js
, and that will lazily import the necessary modules, based in what we actually use in our script.
Currently it is:
- Can this be installed via yarn? We've moving other dependencies to that approach.
We indeed are, but I found no published package in NPM for the released files.
Looks like most people use it by either:
-
Hotlinking from the Google CDN
-
Using their custom webpack integration.
And their current releases cover only those uses. So I went with the old school, download the release, and unpack in the folder removing all previous files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xfalcox I had initially looked at this and given up, but I just had a second look and I think we can add these via yarn
. Each module is a separate package in npm/yarn. For example: https://yarnpkg.com/en/package/workbox-core. When added via yarn add workbox-core
it has the build files in node_modules/workbox-core/build/
.
So we would need to select the modules used, and modify our javascript rake task to copy the selected files to public/
or vendor/
.
Let me know if I can help further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWESOME tip @pmusaraj !
Just force pushed with all being handled by yarn now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice now!
@eviltrout let's merge after next beta? |
Sounds good to me! The ember upgrade is going in at the same time so we'll have to take that into account when triaging issues. |
No description provided.