pwa 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +11 -7
- data/app/controllers/pwa/apps_controller.rb +1 -1
- data/app/views/mozaic/pwa/_manifest.html +1 -1
- data/lib/pwa/railtie.rb +1 -0
- data/lib/pwa/version.rb +1 -1
- metadata +6 -22
- data/vendor/assets/javascripts/pwa.js +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79a9115e917a05a1ba27a01db53e8f0d992198f9748cc6e64727d569603cb0fb
|
4
|
+
data.tar.gz: bc9e3b279f638a17abafa6101b09495ab612ee2a08eeea47ae940c2bf3127a37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3950e131101fbfc4c0c6364ae1c0941a22e375179d144b071e8a16a9bfcb87def85ded1526ea3586ad10a80dc0ceab7866e7970f02157ff7e574bd29dcd4a700
|
7
|
+
data.tar.gz: 63e62558fa5234f5fa2f69125f6e2bbb2583cd3a10ab2c277cc354f06bbfee18f9990a83dec3bed1c6d1328115afa820c420b7b3e4a127199d32e4d1f4be5c6d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -11,11 +11,11 @@ This gem only provides the foundation you can build your Progressive Web App upo
|
|
11
11
|
* **Fast** - Respond quickly to user interactions with silky smooth animations and no janky scrolling.
|
12
12
|
* There are two technologies helping you with performance: *Turbolinks* & *AMP*. When you are using Turbolinks, use [TurbolinksAnimate](https://github.com/jonhue/turbolinks-animate) to get XHR requests + smooth page transitions that add some delight to using to your app. If you want to use AMP, take a look at [amp-html](https://github.com/jonhue/amp-html), an Accelerated Mobile Pages library for Rails apps.
|
13
13
|
* **Engaging** - Feel like a natural app on the device, with an immersive user experience.
|
14
|
-
* When you think about making your app more engaging, you can't get around user-notifications. OneSignal is a powerful (& free) solution. With [
|
14
|
+
* When you think about making your app more engaging, you can't get around user-notifications. OneSignal is a powerful (& free) solution. With [OnSignal](https://github.com/jonhue/onsignal) and [notification-pusher-onesignal](https://github.com/jonhue/notifications-rails/tree/master/notification-pusher/notification-pusher-onesignal) adding native notification capabilities to your app becomes dead simple.
|
15
15
|
|
16
16
|
---
|
17
17
|
|
18
|
-
If a PWA is not enough and you want to bring your Web App into the store - check out [
|
18
|
+
If a PWA is not enough and you want to bring your Web App into the store - check out [NativeGap](https://github.com/NativeGap/nativegap-rails).
|
19
19
|
|
20
20
|
---
|
21
21
|
|
@@ -29,7 +29,7 @@ If a PWA is not enough and you want to bring your Web App into the store - check
|
|
29
29
|
* [Offline pages](#offline-pages)
|
30
30
|
* [Themes](#themes)
|
31
31
|
* [Service worker](#service-worker)
|
32
|
-
* [
|
32
|
+
* [Styles](#styles)
|
33
33
|
* [Configuration](#configuration)
|
34
34
|
* [To Do](#to-do)
|
35
35
|
* [Contributing](#contributing)
|
@@ -69,6 +69,7 @@ gem 'pwa', github: 'jonhue/pwa'
|
|
69
69
|
|
70
70
|
Run the generators:
|
71
71
|
|
72
|
+
$ rails g mozaic:install
|
72
73
|
$ rails g pwa:install
|
73
74
|
$ rails g pwa:app -n "App"
|
74
75
|
|
@@ -86,13 +87,16 @@ Add the following to the `head` tag of your layout file:
|
|
86
87
|
= component 'pwa/manifest'
|
87
88
|
```
|
88
89
|
|
89
|
-
|
90
|
+
Now add the `pwa-rails` NPM package and initialize it:
|
90
91
|
|
91
92
|
```js
|
92
|
-
|
93
|
+
import ProgressiveWebApp from 'pwa-rails';
|
94
|
+
document.addEventListener( 'turbolinks:load', () => {
|
95
|
+
const progressiveWebApp = new ProgressiveWebApp();
|
96
|
+
})
|
93
97
|
```
|
94
98
|
|
95
|
-
**Note:** If
|
99
|
+
**Note:** If the name of the service worker is not the default `/pwa-sw.js` you can specify a custom path: `new ProgressiveWebApp('/custom-path.js')`
|
96
100
|
|
97
101
|
Lastly, go to your routes file (`config/routes.rb`) and mount the `Pwa::Engine` class:
|
98
102
|
|
@@ -153,7 +157,7 @@ You can customize the page that shows up when a requested page has not been cach
|
|
153
157
|
importScripts('https://example.com/pwa-sw.js');
|
154
158
|
```
|
155
159
|
|
156
|
-
###
|
160
|
+
### Styles
|
157
161
|
|
158
162
|
To detect whether or not your app is currently being used as a Progressive Web App, you can use CSS media queries:
|
159
163
|
|
@@ -1 +1 @@
|
|
1
|
-
<link rel='manifest' href=
|
1
|
+
<link rel='manifest' href="#{request.base_url}/manifest.json" />
|
data/lib/pwa/railtie.rb
CHANGED
data/lib/pwa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Hübotter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -66,7 +66,8 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.52'
|
69
|
-
description:
|
69
|
+
description: Add a service worker and a manifest to your app, for it to be recognized
|
70
|
+
as a PWA and accessed without a network connection.
|
70
71
|
email: me@jonhue.me
|
71
72
|
executables: []
|
72
73
|
extensions: []
|
@@ -93,28 +94,11 @@ files:
|
|
93
94
|
- lib/pwa/engine.rb
|
94
95
|
- lib/pwa/railtie.rb
|
95
96
|
- lib/pwa/version.rb
|
96
|
-
|
97
|
-
homepage: https://github.com/jonhue/pwa
|
97
|
+
homepage: https://jonhue.me/repos/progressive-web-apps-for-rails
|
98
98
|
licenses:
|
99
99
|
- MIT
|
100
100
|
metadata: {}
|
101
|
-
post_install_message:
|
102
|
-
**Thank you for installing Progressive Web Apps for Rails!**
|
103
|
-
|
104
|
-
|
105
|
-
There are three more steps to take:
|
106
|
-
|
107
|
-
1) Run `rails g pwa:install` and `rails g pwa:install -n "Application Name"`
|
108
|
-
2) Include the manifest component in your head tag:
|
109
|
-
|
110
|
-
<%= component 'pwa/manfest' %>
|
111
|
-
|
112
|
-
3) Mount engine in `config/routes.rb`:
|
113
|
-
|
114
|
-
mount Pwa::Engine, at: ''
|
115
|
-
|
116
|
-
|
117
|
-
Learn more at https://github.com/jonhue/pwa
|
101
|
+
post_install_message:
|
118
102
|
rdoc_options: []
|
119
103
|
require_paths:
|
120
104
|
- lib
|
@@ -1,9 +0,0 @@
|
|
1
|
-
if (navigator.serviceWorker.controller) {
|
2
|
-
console.log('[PWA] Active service worker found')
|
3
|
-
} else {
|
4
|
-
navigator.serviceWorker.register( '/pwa-sw.js', { scope: './' }).then(function(reg) {
|
5
|
-
console.log( '[PWA] ServiceWorker registration successful with scope: ', reg.scope );
|
6
|
-
}, function(err) {
|
7
|
-
console.log( '[PWA] ServiceWorker registration failed: ', err );
|
8
|
-
});
|
9
|
-
}
|