Skip to content

Commit

Permalink
L: Made hashes a bit shorter and uhm, improved the character replacem…
Browse files Browse the repository at this point in the history
…ent thing
  • Loading branch information
artemislena committed Apr 19, 2023
1 parent 7c4d325 commit 3154950
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions _deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ umask 022
# Calculate hashes to append as query parameters to the paths in /static
echo 'Calculating hashes…'
find static -type d -exec mkdir -p _data/hashes/{} \; >/dev/null
# This one prepends "-" if filename starts with a digit and replaces "." with "_" in filename (note, echo usage might be shell-specific, see https://stackoverflow.com/questions/44448096/echo-the-character-dash-in-the-unix-command-line)
find static -type f -not -name '.DS_Store' -exec sh -c 'echo "\"$(xxh32sum {} | cut -d " " -f 1)\"" > "_data/hashes/$(dirname {})/$(basename {} | cut -c 1 | grep -q "[0-9]" && echo -)$(basename {} | tr "." "_").json"' \;
# This one replaces "." with "-" and prepends it if filename starts with a digit (note, echo usage might be shell-specific, see https://stackoverflow.com/questions/44448096/echo-the-character-dash-in-the-unix-command-line)
find static -type f -not -name '.DS_Store' -exec sh -c 'echo "\"$(xxh32sum {} | cut -d " " -f 1 | xxd -r -p | base64 | sed s/=//g | tr +/ -_)\"" > "_data/hashes/$(dirname {})/$(basename {} | cut -c 1 | grep -q "[0-9]" && echo -)$(basename {} | tr . -).json"' \;

cobalt build

Expand Down
6 changes: 3 additions & 3 deletions _layouts/default.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="cobalt">
<meta name="description" content="{{ site.description }}">
<link href="/static/icon.webp?h={{ site.data.hashes.static.icon_webp }}" rel="icon" type="image/webp" sizes="16x16">
<link href="/static/icon.svg?h={{ site.data.hashes.static.icon_svg }}" rel="icon" type="image/svg+xml" sizes="any">
<link href="/static/style.css?h={{ site.data.hashes.static.style_css }}" rel="stylesheet" type="text/css">
<link href="/static/icon.webp?h={{ site.data.hashes.static.icon-webp }}" rel="icon" type="image/webp" sizes="16x16">
<link href="/static/icon.svg?h={{ site.data.hashes.static.icon-svg }}" rel="icon" type="image/svg+xml" sizes="any">
<link href="/static/style.css?h={{ site.data.hashes.static.style-css }}" rel="stylesheet" type="text/css">
<title>{{ site.title }}{% unless page.permalink == '' %} - {{ page.permalink }}{% endunless %}</title>
<meta property="og:title" content="{{ site.title }}{% unless page.permalink == '' %} - {{ page.permalink }}{% endunless %}">
<meta property="og:type" content="website">
Expand Down

0 comments on commit 3154950

Please sign in to comment.