-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathindex.js
31 lines (25 loc) · 1.02 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const _ = require('lodash')
const fs = require('fs')
const path = require('path')
const stringify = require('data2xml')({attrProp: '@'})
// https://msdn.microsoft.com/en-us/library/dn320426
const defaults = {
tile: {
square150x150logo: {'@': {src: 'icon.png'}},
TileColor: '#3f51b5'
}
}
module.exports = function nuxtBrowserConfig (options) {
let browserConfigData = {
msapplication: _.defaultsDeep(this.options.browserconfig || options.browserconfig || {}, defaults)
}
// Write browserconfig.xml
let browserconfigFileName = options.fileName || 'browserconfig.xml'
let browserconfigFilePath = path.resolve(this.options.srcDir, 'static', browserconfigFileName)
fs.writeFileSync(browserconfigFilePath, stringify('browserconfig', browserConfigData), 'utf8')
// Add browserconfig meta
if (!_.find(this.options.head.meta, {name: 'msapplication-config'})) {
this.options.head.meta.push({name: 'msapplication-config', content: '/' + browserconfigFileName})
}
}
module.exports.meta = require('./package.json')