Permalink
Browse files

feat(manifest): add lang

PWA
  • Loading branch information...
pi0 committed Jun 2, 2017
1 parent 45b2bb2 commit bfdb96e6e2d27ec254652f7bd1306b62b13c7765
Showing with 11 additions and 1 deletion.
  1. +1 −0 modules/manifest/README.md
  2. +10 −1 modules/manifest/index.js
@@ -6,6 +6,7 @@ Adds [Web App Manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) w
- Adds `<link rel=favicon>` to pages if not exits.
- Adds `<meta name=description>` to pages if not exits.
- Adds `<meta name=theme-color>` to pages if not exits.
- Adds `<html lang=>` lang to pages if not exits.
- Adds title to pages if not exits.
## Setup
@@ -26,7 +26,8 @@ module.exports = function nuxtManifest(options) {
start_url: '/',
display: 'standalone',
background_color: '#ffffff',
theme_color: (this.options.loading && this.options.loading.color) || '#3f51b5'
theme_color: (this.options.loading && this.options.loading.color) || '#3f51b5',
lang: 'en'
}
// Write manifest.json
@@ -66,6 +67,14 @@ module.exports = function nuxtManifest(options) {
if (manifest.description && !_.find(this.options.head.meta, {name: 'theme-color'})) {
this.options.head.meta.push({name: 'theme-color', content: manifest.theme_color})
}
// Add lang to html tag
if (manifest.lang && !(this.options.head.htmlAttrs && this.options.head.htmlAttrs.lang)) {
if (!this.options.head.htmlAttrs) {
this.options.head.htmlAttrs = {}
}
this.options.head.htmlAttrs.lang = manifest.lang
}
}
module.exports.meta = require('./package.json')

0 comments on commit bfdb96e

Please sign in to comment.