Commit 646310c7 authored by lunasorcery's avatar lunasorcery
Browse files

force cache refreshes on css changes

parent 1ec25109
......@@ -4,6 +4,7 @@ import os
import json
import shutil
import chevron
import binascii
from wand.image import Image
......@@ -12,6 +13,12 @@ def maybe_mkdir(path):
os.mkdir(path)
def crc32_file(filename):
buf = open(filename,'rb').read()
buf = (binascii.crc32(buf) & 0xffffffff)
return f"{buf:08x}"
# disable meteoriks from view for now
meteoriksVisible = False
......@@ -107,24 +114,28 @@ for idx,prod in enumerate(prods):
raise hell
sharedTemplate = {
'meteoriks-visible': meteoriksVisible,
'hash-fonts-css': crc32_file('fonts.css'),
'hash-style-css': crc32_file('style.css'),
}
print("applying templates...")
with open('index.mustache', 'r') as f:
with open('gen/index.html', 'w') as fout:
fout.write(chevron.render(f, {
'meteoriks-visible': meteoriksVisible,
fout.write(chevron.render(f, sharedTemplate | {
'page-gallery': True,
'entries': prods }))
if meteoriksVisible:
with open('meteoriks.mustache', 'r') as f:
with open('gen/meteoriks.html', 'w') as fout:
fout.write(chevron.render(f, {
'meteoriks-visible': meteoriksVisible,
fout.write(chevron.render(f, sharedTemplate | {
'page-meteoriks': True,
'entries': meteorikProds }))
with open('about.mustache', 'r') as f:
with open('gen/about.html', 'w') as fout:
fout.write(chevron.render(f, {
'meteoriks-visible': meteoriksVisible,
fout.write(chevron.render(f, sharedTemplate | {
'page-about': True }))
......@@ -4,8 +4,8 @@
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>executable.graphics</title>
<link href="fonts.css" rel="stylesheet"/>
<link href="style.css" rel="stylesheet"/>
<link href="fonts.css?cache={{hash-fonts-css}}" rel="stylesheet"/>
<link href="style.css?cache={{hash-style-css}}" rel="stylesheet"/>
</head>
<body>
<label class="theme-switch" for="checkbox">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment