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