UNPKG

931 BJavaScriptView Raw
1/* eslint-disable indent */
2
3module.exports = function headElement(meta){
4 return `<head>
5 <title>${meta.title}</title>
6 <meta charset="${meta.charset}">
7 <meta name="viewport" content="${meta.viewport}">
8
9 <meta name="description" content="${meta.description}">
10 <meta name="keywords" content="${meta.keywords}">
11 <meta name="author" content="${meta.author}">
12
13 ${
14 meta.hasOwnProperty('extra')
15 ?meta.extra.length
16 ? meta.extra.map(value => `<meta ${value}>`)
17 : ''
18 :''
19 }
20
21 ${
22 meta.hasOwnProperty('stylesheets')
23 ?meta.stylesheets.length
24 ?meta.stylesheets.map(value => `<link rel="stylesheet" href="${value}">`).join('\n')
25 : ''
26 : ''
27 }
28
29 ${
30 meta.hasOwnProperty('scripts')
31 ?meta.scripts.length
32 ?meta.scripts.map(value => `<script src="${value}"></script>`).join('\n')
33 : ''
34 : ''
35 }
36
37 <link rel="icon" type="image/png" href="${meta.favicon}">
38 </head>`;
39};