@inglorious/ssx 1.10.1 → 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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/ssx",
3
- "version": "1.10.1",
3
+ "version": "1.11.0",
4
4
  "description": "Server-Side-X. Xecution? Xperience? Who knows.",
5
5
  "author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
6
6
  "license": "MIT",
@@ -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,6 +30,9 @@ 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}">