Skip to content
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

Merged
merged 1 commit into from
Jul 15, 2019
Merged

Make Discourse work while offline #7870

merged 1 commit into from
Jul 15, 2019

Conversation

xfalcox
Copy link
Member

@xfalcox xfalcox commented Jul 9, 2019

No description provided.

@discoursebot
Copy link

You've signed the CLA, xfalcox. Thank you! This pull request is ready for review.

@xfalcox xfalcox added the javascript Pull requests that update Javascript code label Jul 9, 2019
@@ -1,117 +1,25 @@
'use strict';

importScripts("<%= ::UrlHelper.absolute("/javascripts/workbox/workbox-sw.js") %>");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple questions here:

  1. 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.

  2. Can this be installed via yarn? We've moving other dependencies to that approach.

Copy link
Member Author

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:

image

  1. 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.

Copy link
Contributor

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.

Copy link
Member Author

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!

Copy link
Contributor

@eviltrout eviltrout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice now!

@xfalcox
Copy link
Member Author

xfalcox commented Jul 10, 2019

@eviltrout let's merge after next beta?

@eviltrout
Copy link
Contributor

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.

@xfalcox xfalcox merged commit 1221d34 into master Jul 15, 2019
@jomaxro jomaxro deleted the offline branch October 2, 2019 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code
Development

Successfully merging this pull request may close these issues.

4 participants