cache busting
This commit is contained in:
parent
eb36f2d7b6
commit
6b3b978b61
1 changed files with 9 additions and 7 deletions
16
build.py
16
build.py
|
@ -12,26 +12,28 @@ def run(*args):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
time = datetime.datetime.now()
|
||||||
|
time_id = time.strftime('%Y%m%d%H%M%S')
|
||||||
style = 'css'
|
style = 'css'
|
||||||
script = 'js'
|
script = 'js'
|
||||||
root = os.path.dirname(os.path.realpath(__file__))
|
root = os.path.dirname(os.path.realpath(__file__))
|
||||||
input_directory = os.path.join(root, 'in')
|
input_directory = os.path.join(root, 'in')
|
||||||
out = os.path.join(root, 'out')
|
out = os.path.join(root, 'out')
|
||||||
web = os.path.join(out, 'web')
|
web = os.path.join(out, 'web')
|
||||||
css = os.path.join(web, style)
|
gen = os.path.join(web, time_id)
|
||||||
js = os.path.join(web, script)
|
css = os.path.join(gen, style)
|
||||||
|
js = os.path.join(gen, script)
|
||||||
#
|
#
|
||||||
run('rsync', '--archive', f'{input_directory}/', f'{web}/')
|
run('rsync', '--archive', f'{input_directory}/', f'{web}/')
|
||||||
for directory in [css, js]:
|
for directory in [css, js]:
|
||||||
os.makedirs(directory, exist_ok=True)
|
os.makedirs(directory, exist_ok=True)
|
||||||
#
|
#
|
||||||
link_gv = os.path.join(root, 'link.gv')
|
link_gv = os.path.join(root, 'link.gv')
|
||||||
link_svg = os.path.join(web, 'link.svg')
|
link_svg = os.path.join(gen, 'link.svg')
|
||||||
run('dot', link_gv, '-Tsvg', '-o', link_svg)
|
run('dot', link_gv, '-Tsvg', '-o', link_svg)
|
||||||
with open(link_svg, 'br') as f:
|
with open(link_svg, 'br') as f:
|
||||||
link_text = f.read().decode('u8')
|
link_text = f.read().decode('u8')
|
||||||
page_file = os.path.join(web, 'index.html')
|
page_file = os.path.join(web, 'index.html')
|
||||||
timestamp = datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')
|
|
||||||
page_text = f'''\
|
page_text = f'''\
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
@ -41,8 +43,8 @@ def main():
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="flattr:id" content="z3d26l" />
|
<meta name="flattr:id" content="z3d26l" />
|
||||||
<meta name="viewport" content="initial-scale=1,width=device-width" />
|
<meta name="viewport" content="initial-scale=1,width=device-width" />
|
||||||
<link rel="stylesheet" href="{style}/index.css" />
|
<link rel="stylesheet" href="{time_id}/{style}/index.css" />
|
||||||
<script src="{script}/index.js"></script>
|
<script src="{time_id}/{script}/index.js"></script>
|
||||||
<title>Marc Beninca</title>
|
<title>Marc Beninca</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -183,7 +185,7 @@ def main():
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<hr />
|
<hr />
|
||||||
Last update: {timestamp}
|
Last update: {time.strftime('%Y/%m/%d %H:%M:%S')}
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue