Skip to content

Conversation

@SaschaDens
Copy link

Last I was sitting on the train and I've wanted to use RegExr but I couldn't since I didn't had an internet connection available.

With this PR I've implemented a service worker to make RegExr also useable offline.

This PR contains:

  • .editorconfig: for IDE to apply the same formatting as the rest of the code (http://editorconfig.org/)
  • sw-precache: integrated in the gulp build file to generate a service-worker.js file with the available resources in build folder
  • gulp-rev & gulp-rev-replace: sw-precache creates a service-worker.js file to cache the resources. But some resources couldn't be cached due to the template tag noCache dateTime. This couldn't be automatically stored in service-worker.js. Gulp-rev will add a hash to the resource filename and Gulp-rev-replace will inject the new filename in the build.
  • fonts.gstatic.com: to load over HTTP or HTTPS dynamically. This makes it possible to serve Regexr over HTTPS.

Service worker functionality is only available on pages that are accessed via HTTPS or localhost. This means that regexr.com should be forced to load over HTTPS. The free service https://letsencrypt.org/ could be used to provides certificates. (github also offers pages over HTTPS)

An example of this implementation could be found on the following url: https://saschadens.github.io/

Kind regards,
Sascha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant