e11sync-static: fix caching
This commit is contained in:
parent
7cec799cfa
commit
d54da85c56
|
@ -6,7 +6,7 @@
|
|||
writeTextFile {
|
||||
name = "e11sync-caddyfile";
|
||||
text = ''
|
||||
header /static/CACHE/* Cache-Control "public, max-age=31536000, immutable"
|
||||
header /static/* Cache-Control "public, max-age=31536000, immutable"
|
||||
|
||||
route /static/* {
|
||||
uri strip_prefix /static
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
brotli,
|
||||
findutils,
|
||||
dart-sass,
|
||||
jq,
|
||||
}: let
|
||||
self = stdenv.mkDerivation {
|
||||
name = "e11sync-static";
|
||||
|
@ -18,14 +19,20 @@
|
|||
];
|
||||
patchPhase = ''patchShebangs --build app/manage.py'';
|
||||
buildPhase = ''
|
||||
export E11SYNC_DEBUG=
|
||||
make -C static style.css
|
||||
app/manage.py collectstatic
|
||||
|
||||
# remove unversioned files
|
||||
(cd app/_static;
|
||||
${jq}/bin/jq -r '.paths | keys[]' staticfiles.json | \
|
||||
xargs rm
|
||||
)
|
||||
|
||||
find app/_static \
|
||||
-name '*.css' -or \
|
||||
-name '*.js' -or \
|
||||
-name '*.svg' | \
|
||||
-name '*.svg' -or \
|
||||
-name '*.txt' | \
|
||||
tee >(xargs -n1 -P''$(nproc) ${zopfli}/bin/zopfli) | \
|
||||
xargs -n1 -P''$(nproc) ${brotli}/bin/brotli
|
||||
'';
|
||||
|
|
Loading…
Reference in New Issue