mirror of
https://github.com/ruuda/rcl.git
synced 2025-12-23 04:47:19 +00:00
Make website resources input-addressible
Okay on my first deploy I ran into caching issues already, let's sort this out right away.
This commit is contained in:
parent
0993b3199c
commit
606f0d13ee
2 changed files with 14 additions and 4 deletions
17
flake.nix
17
flake.nix
|
|
@ -232,10 +232,21 @@
|
|||
''
|
||||
mkdir -p $out
|
||||
cp $src/* $out
|
||||
cp ${rcl-wasm}/* $out
|
||||
# TODO: Make js filenames content-addressible to avoid cache problems.
|
||||
|
||||
# Put the artifacts at an input-addressible path, so we don't
|
||||
# have issues with stale cache entries. We can use anything that
|
||||
# changes on release, and one of those things is the Nix base32
|
||||
# hash of the wasm module. This has the advantage that it remains
|
||||
# unchanged if we change the webpage. 8 characters is probably
|
||||
# enough to avoid collisions. To make the path less cryptic, we
|
||||
# also put the human-readable version name in there.
|
||||
hash="v${version}-$(basename ${rcl-wasm} | cut --bytes 1-8)"
|
||||
mkdir -p $out/$hash
|
||||
cp ${rcl-wasm}/* $out/$hash
|
||||
sed --in-place "s|rcl\.js|$hash/rcl.js|" $out/index.html
|
||||
|
||||
# Pre-compress all assets for use with brotli_static in Nginx.
|
||||
for f in $out/*; do brotli -9 $f; done
|
||||
for f in $(find $out -type f); do brotli -9 $f; done
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -339,7 +339,6 @@
|
|||
font-size: 0.8rem;
|
||||
}
|
||||
</style>
|
||||
<!-- TODO: Use a content-addressable name to avoid caching issues. -->
|
||||
<script src="/rcl.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue