Skip to content

Commit 3c7aa7d

Browse files
author
Pooya Parsa
committedNov 16, 2017
feat(meta): add nativeUI option
#10
1 parent b94862f commit 3c7aa7d

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed
 

Diff for: ‎README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ You can optionally override meta using either `manifest` or `meta` section of `n
113113
// ...
114114
}
115115
}
116-
```
116+
```
117117

118118
### options
119119

120-
Meta / Link | Customize With | Default value
120+
Meta / Link | Customize With | Default value
121121
---------------------------------------|-----------------------|-------------------
122122
`charset` | `charset` | `utf-8`
123123
`viewport` | `viewport` | `width=device-width, initial-scale=1`
@@ -133,8 +133,9 @@ Meta / Link | Customize With | Default value
133133
`og:title` | `ogTitle` | same as options.name
134134
`og:description` | `ogDescription` | same as options.description
135135

136+
By setting `meta.nativeUI` to `true` (Defaults to `false`) `viewport` defaults to `width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, minimal-ui` and `mobileAppIOS` will be enabled if not explicitly set to `false` which is suitable for native looking mobile apps.
136137

137-
Please read this resources before setting IOS specific options:
138+
Please read this resources if you want to enable `mobileAppIOS` option:
138139

139140
- https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html
140141
- https://medium.com/@firt/dont-use-ios-web-app-meta-tag-irresponsibly-in-your-progressive-web-apps-85d70f4438cb
@@ -162,8 +163,8 @@ see [generateSW](https://workboxjs.org/reference-docs/latest/module-workbox-buil
162163

163164
This module automatically generates app icons and favicon with different sizes using [jimp](https://github.com/oliver-moran/jimp).
164165

165-
- This module fills `manifest.icons[]` with proper paths to generated assets that is used by [manifest](../manifest) module.
166-
- Source icon is being resized using *cover* method.
166+
- This module fills `manifest.icons[]` with proper paths to generated assets that is used by [manifest](../manifest) module.
167+
- Source icon is being resized using *cover* method.
167168

168169
### options
169170

@@ -173,7 +174,7 @@ This module automatically generates app icons and favicon with different sizes u
173174
#### `sizes`
174175
- Default: `[16, 120, 144, 152, 192, 384, 512]`
175176

176-
Array of sizes to be generated (Square).
177+
Array of sizes to be generated (Square).
177178

178179
<h2 align="center">License</h2>
179180

Diff for: ‎packages/meta/index.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ module.exports = function nuxtMeta (_options) {
88
charset: 'utf-8',
99
viewport: undefined,
1010
mobileApp: true,
11+
nativeUI: false,
1112
favicon: true,
12-
mobileAppIOS: false,
13+
mobileAppIOS: undefined,
1314
appleStatusBarStyle: 'default',
1415
theme_color: this.options.loading && this.options.loading.color,
1516
lang: 'en',
@@ -23,7 +24,12 @@ module.exports = function nuxtMeta (_options) {
2324

2425
// Default value for viewport
2526
if (options.viewport === undefined) {
26-
options.viewport = 'width=device-width, initial-scale=1'
27+
options.viewport = options.nativeUI ? 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, minimal-ui' : 'width=device-width, initial-scale=1'
28+
}
29+
30+
// Default value for mobileAppIOS
31+
if (options.mobileAppIOS === undefined) {
32+
options.mobileAppIOS = !!options.nativeUI
2733
}
2834

2935
// Charset

0 commit comments

Comments
 (0)
Please sign in to comment.