@inglorious/ssx 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/render/layout.js +6 -1
package/README.md
CHANGED
|
@@ -721,6 +721,7 @@ export default {
|
|
|
721
721
|
},
|
|
722
722
|
|
|
723
723
|
// Global assets
|
|
724
|
+
prescripts: ["./gdpr.js"], // loaded first in <head>, before any other script (e.g. cookie consent)
|
|
724
725
|
styles: ["./styles/reset.css", "./styles/theme.css"],
|
|
725
726
|
scripts: ["./scripts/analytics.js"],
|
|
726
727
|
|
package/package.json
CHANGED
package/src/render/layout.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
export function layout(body, options) {
|
|
17
17
|
const {
|
|
18
18
|
lang = "en",
|
|
19
|
+
prescripts = [],
|
|
19
20
|
charset = "UTF-8",
|
|
20
21
|
title = "",
|
|
21
22
|
favicon = "",
|
|
@@ -29,12 +30,16 @@ export function layout(body, options) {
|
|
|
29
30
|
return `<!DOCTYPE html>
|
|
30
31
|
<html lang="${lang}">
|
|
31
32
|
<head>
|
|
33
|
+
${prescripts
|
|
34
|
+
.map((src) => `<script type="text/javascript" src="${src}"></script>`)
|
|
35
|
+
.join("\n")}
|
|
32
36
|
<meta charset="${charset}" />
|
|
33
37
|
<title>${title}</title>
|
|
34
38
|
<link rel="icon" type="image/x-icon" href="${favicon}">
|
|
35
39
|
${Object.entries(meta)
|
|
36
40
|
.map(
|
|
37
|
-
([
|
|
41
|
+
([key, content]) =>
|
|
42
|
+
`<meta ${key.includes(":") ? "property" : "name"}="${key}" content="${content}">`,
|
|
38
43
|
)
|
|
39
44
|
.join("\n")}
|
|
40
45
|
${styles
|