mirror of
https://github.com/thegeeklab/hugo-geekblog.git
synced 2024-11-22 05:00:39 +00:00
load static css/js assets from data template
This commit is contained in:
parent
fe36135da8
commit
f00b90be78
@ -3,6 +3,11 @@
|
||||
- remove `title` and set empty `alt` tag on branding image
|
||||
- add minimal working CSS for printing
|
||||
- split out mobile CSS
|
||||
- load static css/js assets from data template:
|
||||
This way users can hash static assets and overwrite the data template
|
||||
to deliver the hashed assets. Thats helpful if you have to deal with
|
||||
long cache settings but wont to ensure your updated assets are delivered
|
||||
to clients.
|
||||
- BUGFIX
|
||||
- use relative URL's for fonts
|
||||
- INTERNAL
|
||||
|
8
data/assets.json
Normal file
8
data/assets.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"main.min.css": "main.min.css",
|
||||
"mobile.min.css": "mobile.min.css",
|
||||
"print.min.css": "print.min.css",
|
||||
"custom.css": "custom.css",
|
||||
"js/clipboard.min.js": "js/clipboard.min.js",
|
||||
"js/mermaid.min.js": "js/mermaid.min.js"
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{{ if default true .Site.Params.GeekblogAnchorCopy }}
|
||||
<script defer src="{{ "js/clipboard.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/clipboard.min.js" | relURL }}"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
var clipboard = new ClipboardJS('.clip');
|
||||
|
@ -7,17 +7,17 @@
|
||||
<link rel="preload" as="font" href="{{ "fonts/DroidSans.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous">
|
||||
<link rel="preload" as="font" href="{{ "fonts/GeekblogIcons.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous">
|
||||
|
||||
<link rel="preload" href="{{ "main.min.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ "main.min.css" | relURL }}" media="all">
|
||||
<link rel="preload" href="{{ index .Site.Data.assets "main.min.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "main.min.css" | relURL }}" media="all">
|
||||
|
||||
<link rel="preload" href="{{ "mobile.min.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ "mobile.min.css" | relURL }}" media="screen and (max-width: 45rem)">
|
||||
<link rel="preload" href="{{ index .Site.Data.assets "mobile.min.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "mobile.min.css" | relURL }}" media="screen and (max-width: 45rem)">
|
||||
|
||||
<link rel="preload" href="{{ "print.min.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ "print.min.css" | relURL }}" media="print">
|
||||
<link rel="preload" href="{{ index .Site.Data.assets "print.min.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "print.min.css" | relURL }}" media="print">
|
||||
|
||||
<link rel="preload" href="{{ "custom.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ "custom.css" | relURL }}" media="all">
|
||||
<link rel="preload" href="{{ index .Site.Data.assets "custom.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "custom.css" | relURL }}" media="all">
|
||||
|
||||
{{ with .OutputFormats.Get "atom" }}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{ if not (.Page.Scratch.Get "mermaid") }}
|
||||
<!-- Include mermaid only first time -->
|
||||
<script defer src="{{ "js/mermaid.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/mermaid.min.js" | relURL }}"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
mermaid.initialize({
|
||||
|
Loading…
Reference in New Issue
Block a user