2024-01-14 20:00:17 +02:00
|
|
|
{
|
2024-01-17 10:45:16 +02:00
|
|
|
runCommand,
|
2024-01-14 20:00:17 +02:00
|
|
|
zopfli,
|
|
|
|
brotli,
|
|
|
|
findutils,
|
2024-01-28 18:15:49 +02:00
|
|
|
e11sync-blog,
|
2024-01-28 16:42:17 +02:00
|
|
|
e11sync-djangostatic,
|
|
|
|
}:
|
|
|
|
runCommand "e11sync-static" {
|
2024-01-28 18:15:49 +02:00
|
|
|
srcs = [e11sync-djangostatic e11sync-blog];
|
2024-01-28 16:42:17 +02:00
|
|
|
nativeBuildInputs = [findutils];
|
2024-01-28 18:15:49 +02:00
|
|
|
sourceRoot = ".";
|
2024-01-28 16:42:17 +02:00
|
|
|
} ''
|
|
|
|
unpackPhase
|
2024-01-28 18:15:49 +02:00
|
|
|
|
2024-01-28 22:47:10 +02:00
|
|
|
if ! cmp \
|
|
|
|
e11sync-djangostatic/style.*.css \
|
|
|
|
e11sync-blog/static/style.*.css
|
|
|
|
then
|
|
|
|
echo "style.*.css in blog and djangostatic do not match:"
|
|
|
|
ls -l e11sync-djangostatic/style/style.*.css blog/style/style.*.css
|
|
|
|
exit 1
|
2024-01-28 18:15:49 +02:00
|
|
|
fi
|
|
|
|
|
2024-01-28 22:47:10 +02:00
|
|
|
rm e11sync-djangostatic/style.*.css
|
|
|
|
|
2024-01-28 18:15:49 +02:00
|
|
|
mkdir -p $out
|
2024-01-28 22:47:10 +02:00
|
|
|
mv e11sync-blog/{static,blog,contact} $out/
|
|
|
|
mv --no-clobber e11sync-djangostatic/* $out/static/
|
2024-01-28 18:15:49 +02:00
|
|
|
|
|
|
|
find $out \
|
2024-01-28 16:42:17 +02:00
|
|
|
-name '*.css' -or \
|
|
|
|
-name '*.js' -or \
|
|
|
|
-name '*.svg' -or \
|
2024-01-28 18:15:49 +02:00
|
|
|
-name '*.html' -or \
|
2024-01-28 16:42:17 +02:00
|
|
|
-name '*.txt' | \
|
|
|
|
tee >(xargs -n1 -P''$(nproc) ${zopfli}/bin/zopfli) | \
|
|
|
|
xargs -n1 -P''$(nproc) ${brotli}/bin/brotli
|
|
|
|
''
|