pwa 2.0.1 → 3.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 +21 -2
- data/app/views/mozaic/pwa/_manifest.html +1 -0
- data/app/views/mozaic/pwa/_theme.html.erb +1 -0
- data/lib/pwa.rb +1 -0
- data/lib/pwa/railtie.rb +14 -0
- data/lib/pwa/version.rb +1 -1
- metadata +25 -5
- data/app/helpers/pwa_helper.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e69136de72eed2e30d89504da58d8e4d2472cd3ab7fcb63cdd015cfc4e03922d
|
4
|
+
data.tar.gz: ca30c0c3a157154d23d058454b3b64046cbf20fe7440a3b32be26f42631d6df4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 578ff53f36b826aa4e638ccba011020869a14be7cbbdf5e4b5625ddbc75cf75b66d3df939360bf083e85839218ac9e1b913886dd71695cb91b96cd44c433be69
|
7
|
+
data.tar.gz: 5d2c5de041cc0415540a99a530ef7ff07b8e0d950da74eec6a3108848a69d2209079c33db681d3cf43fe261582ca7748dc0e3e625e9f1290b7dcb679cb8a4bd2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -27,6 +27,7 @@ If a PWA is not enough and you want to bring your Web App into the store - check
|
|
27
27
|
* [Apps](#apps)
|
28
28
|
* [Manifest](#manifest)
|
29
29
|
* [Offline pages](#offline-pages)
|
30
|
+
* [Themes](#themes)
|
30
31
|
* [Service worker](#service-worker)
|
31
32
|
* [Views](#views)
|
32
33
|
* [Configuration](#configuration)
|
@@ -71,7 +72,7 @@ Run the generators:
|
|
71
72
|
$ rails g pwa:install
|
72
73
|
$ rails g pwa:app -n "App"
|
73
74
|
|
74
|
-
|
75
|
+
Now define your app:
|
75
76
|
|
76
77
|
```ruby
|
77
78
|
Pwa.configure do |config|
|
@@ -82,7 +83,7 @@ end
|
|
82
83
|
Add the following to the `head` tag of your layout file:
|
83
84
|
|
84
85
|
```haml
|
85
|
-
=
|
86
|
+
= component 'pwa/manifest'
|
86
87
|
```
|
87
88
|
|
88
89
|
Make sure to add the required javascript in `app/assets/javascripts/application.js`:
|
@@ -91,6 +92,8 @@ Make sure to add the required javascript in `app/assets/javascripts/application.
|
|
91
92
|
//= require pwa
|
92
93
|
```
|
93
94
|
|
95
|
+
**Note:** If you are using Webpack instead of Sprockets, add and import the `pwa-rails` NPM package.
|
96
|
+
|
94
97
|
Lastly, go to your routes file (`config/routes.rb`) and mount the `Pwa::Engine` class:
|
95
98
|
|
96
99
|
```ruby
|
@@ -122,6 +125,22 @@ The app generator generates a manifest file located in the `app/views/pwa/apps/m
|
|
122
125
|
|
123
126
|
Progressive Web Apps for Rails automatically stores a copy of the offline page (`app/views/pwa/apps/offline/_app.html.erb`) in the users cache, so your app is accessible at any time, even if requested URLs have not been cached yet.
|
124
127
|
|
128
|
+
### Themes
|
129
|
+
|
130
|
+
Progressive Web Apps for Rails simplifies adding themes reflected in browsers to your site. Add the following to the `head` tag in your layout file:
|
131
|
+
|
132
|
+
```haml
|
133
|
+
= component 'pwa/theme', default: '#000000'
|
134
|
+
```
|
135
|
+
|
136
|
+
**Note:** `default` falls back to `#FFFFFF`.
|
137
|
+
|
138
|
+
You can now override the default theme color from your views:
|
139
|
+
|
140
|
+
```haml
|
141
|
+
- area :pwa_theme, '#FF0000'
|
142
|
+
```
|
143
|
+
|
125
144
|
### Service worker
|
126
145
|
|
127
146
|
The generator also generates a service worker which caches visited pages to the local storage so they can get accessed even if the device has no network connection.
|
@@ -0,0 +1 @@
|
|
1
|
+
<link rel='manifest' href='manifest.json' />
|
@@ -0,0 +1 @@
|
|
1
|
+
<meta name="theme-color" content="<%= area :pwa_theme, options[:default] %>">
|
data/lib/pwa.rb
CHANGED
data/lib/pwa/railtie.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails/railtie'
|
2
|
+
|
3
|
+
module Pwa
|
4
|
+
class Railtie < Rails::Railtie
|
5
|
+
|
6
|
+
initializer 'pwa.mozaic' do
|
7
|
+
Mozaic.configure do |config|
|
8
|
+
config.define_component 'pwa/manifest'
|
9
|
+
config.define_component 'pwa/theme', default: '#FFFFFF'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
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: 3.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-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mozaic
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,7 +76,8 @@ files:
|
|
62
76
|
- LICENSE
|
63
77
|
- README.md
|
64
78
|
- app/controllers/pwa/apps_controller.rb
|
65
|
-
- app/
|
79
|
+
- app/views/mozaic/pwa/_manifest.html
|
80
|
+
- app/views/mozaic/pwa/_theme.html.erb
|
66
81
|
- app/views/pwa/apps/manifest.json.erb
|
67
82
|
- app/views/pwa/apps/offline.html.erb
|
68
83
|
- config/routes.rb
|
@@ -76,6 +91,7 @@ files:
|
|
76
91
|
- lib/pwa/app.rb
|
77
92
|
- lib/pwa/configuration.rb
|
78
93
|
- lib/pwa/engine.rb
|
94
|
+
- lib/pwa/railtie.rb
|
79
95
|
- lib/pwa/version.rb
|
80
96
|
- vendor/assets/javascripts/pwa.js
|
81
97
|
homepage: https://github.com/jonhue/pwa
|
@@ -86,10 +102,14 @@ post_install_message: |
|
|
86
102
|
**Thank you for installing Progressive Web Apps for Rails!**
|
87
103
|
|
88
104
|
|
89
|
-
There are
|
105
|
+
There are three more steps to take:
|
90
106
|
|
91
107
|
1) Run `rails g pwa:install` and `rails g pwa:install -n "Application Name"`
|
92
|
-
2)
|
108
|
+
2) Include the manifest component in your head tag:
|
109
|
+
|
110
|
+
<%= component 'pwa/manfest' %>
|
111
|
+
|
112
|
+
3) Mount engine in `config/routes.rb`:
|
93
113
|
|
94
114
|
mount Pwa::Engine, at: ''
|
95
115
|
|