aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile7
-rw-r--r--config.json3
-rw-r--r--config.toml3
-rw-r--r--config.yaml3
-rw-r--r--themes/default/layouts/partials/csp.html8
-rw-r--r--themes/default/layouts/partials/head.html17
7 files changed, 32 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index 4077f0f..6488bc4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
icons
public
resources
+assets
diff --git a/Makefile b/Makefile
index 99aef3d..d428258 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
all:
make config
make js
+ make css
make hugo
config:
@@ -12,6 +13,12 @@ watch:
js:
deno bundle --no-check --config tsconfig.json static/js/index.ts static/js/index.js
+ mkdir -p assets/js
+ cp static/js/index.js assets/js
+
+css:
+ mkdir -p assets/css
+ cp static/css/* assets/css
hugo:
rm -rf public
diff --git a/config.json b/config.json
index 357c47b..dfe7dce 100644
--- a/config.json
+++ b/config.json
@@ -83,7 +83,7 @@
}
},
"params": {
- "production": false,
+ "production": true,
"webmanifest": {
"name": "Micro Blog",
"shortName": "Micro",
@@ -93,6 +93,7 @@
"logo": "images/logo.png"
},
"csp": {
+ "upgrade": false,
"referrer": "origin",
"childsrc": [
"'self'"
diff --git a/config.toml b/config.toml
index 676c81e..eaffbb7 100644
--- a/config.toml
+++ b/config.toml
@@ -80,7 +80,7 @@ enableRobotsTXT = true
noHl = false
[params]
- production = false
+ production = true
[params.webmanifest]
name = "Micro Blog"
@@ -91,6 +91,7 @@ enableRobotsTXT = true
logo = "images/logo.png"
[params.csp]
+ upgrade = false
referrer = "origin"
childsrc = ["'self'"]
fontsrc = ["'self'"]
diff --git a/config.yaml b/config.yaml
index 5842f8f..5645336 100644
--- a/config.yaml
+++ b/config.yaml
@@ -67,7 +67,7 @@ markup:
noHl: false
params:
- production: false
+ production: true
webmanifest:
name: Micro Blog
shortName: Micro
@@ -76,6 +76,7 @@ params:
display: standalone
logo: images/logo.png
csp:
+ upgrade: false
referrer: origin
childsrc: ["'self'"]
fontsrc: ["'self'"]
diff --git a/themes/default/layouts/partials/csp.html b/themes/default/layouts/partials/csp.html
index 62489ec..d148498 100644
--- a/themes/default/layouts/partials/csp.html
+++ b/themes/default/layouts/partials/csp.html
@@ -1,8 +1,8 @@
-{{ $upgrade := "" }}
+{{- $upgrade := "" -}}
-{{ if .Site.Params.production }}
- {{ $upgrade = "upgrade-insecure-requests" }}
-{{ end }}
+{{- if .Site.Params.csp.upgrade -}}
+ {{ $upgrade = "upgrade-insecure-requests;" }}
+{{- end -}}
<base href="{{ .Site.BaseURL }}">
<meta name="referrer" content="{{ .Site.Params.csp.referrer }}">
diff --git a/themes/default/layouts/partials/head.html b/themes/default/layouts/partials/head.html
index e45b5d6..fd04ed0 100644
--- a/themes/default/layouts/partials/head.html
+++ b/themes/default/layouts/partials/head.html
@@ -35,13 +35,24 @@
<!-- Content Security Policy -->
{{- partial "csp.html" . -}}
-<!-- Style Sheets -->
+<!-- Style Sheets & Scripts -->
+{{- if .Site.Params.production -}}
+
+{{- $default := resources.Get "css/default.css" -}}
+{{- $syntax := resources.Get "css/syntax-highlight-default.css" -}}
+{{ $css := slice $default $syntax | resources.Concat "css/bundle.css" | resources.Minify | fingerprint }}
+<link rel="stylesheet" href="{{ $css.Permalink }}">
+{{ $js := resources.Get "js/index.js" | resources.Minify | fingerprint }}
+<script src="{{ $js.Permalink }}"></script>
+
+{{ else }}
+
<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/default.css">
<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/syntax-highlight-default.css">
-
-<!-- Scripts -->
<script src="{{ .Site.BaseURL }}/js/index.js"></script>
+{{- end -}}
+
<!-- No Scripts -->
<noscript>
<style>