From 3c7aa7d0199ce3ab0d7fff606d52b913dba0f34e Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 16 Nov 2017 15:53:23 +0330 Subject: [PATCH] feat(meta): add nativeUI option #10 --- README.md | 13 +++++++------ packages/meta/index.js | 10 ++++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f2254264..625f0b1c 100644 --- a/README.md +++ b/README.md @@ -113,11 +113,11 @@ You can optionally override meta using either `manifest` or `meta` section of `n // ... } } -``` +``` ### options -Meta / Link | Customize With | Default value +Meta / Link | Customize With | Default value ---------------------------------------|-----------------------|------------------- `charset` | `charset` | `utf-8` `viewport` | `viewport` | `width=device-width, initial-scale=1` @@ -133,8 +133,9 @@ Meta / Link | Customize With | Default value `og:title` | `ogTitle` | same as options.name `og:description` | `ogDescription` | same as options.description +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. -Please read this resources before setting IOS specific options: +Please read this resources if you want to enable `mobileAppIOS` option: - https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html - 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 This module automatically generates app icons and favicon with different sizes using [jimp](https://github.com/oliver-moran/jimp). -- This module fills `manifest.icons[]` with proper paths to generated assets that is used by [manifest](../manifest) module. -- Source icon is being resized using *cover* method. +- This module fills `manifest.icons[]` with proper paths to generated assets that is used by [manifest](../manifest) module. +- Source icon is being resized using *cover* method. ### options @@ -173,7 +174,7 @@ This module automatically generates app icons and favicon with different sizes u #### `sizes` - Default: `[16, 120, 144, 152, 192, 384, 512]` -Array of sizes to be generated (Square). +Array of sizes to be generated (Square).

License

diff --git a/packages/meta/index.js b/packages/meta/index.js index 6ddb1652..0997852a 100755 --- a/packages/meta/index.js +++ b/packages/meta/index.js @@ -8,8 +8,9 @@ module.exports = function nuxtMeta (_options) { charset: 'utf-8', viewport: undefined, mobileApp: true, + nativeUI: false, favicon: true, - mobileAppIOS: false, + mobileAppIOS: undefined, appleStatusBarStyle: 'default', theme_color: this.options.loading && this.options.loading.color, lang: 'en', @@ -23,7 +24,12 @@ module.exports = function nuxtMeta (_options) { // Default value for viewport if (options.viewport === undefined) { - options.viewport = 'width=device-width, initial-scale=1' + options.viewport = options.nativeUI ? 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, minimal-ui' : 'width=device-width, initial-scale=1' + } + + // Default value for mobileAppIOS + if (options.mobileAppIOS === undefined) { + options.mobileAppIOS = !!options.nativeUI } // Charset