fingerprint deployed stylesheet assets

This commit is contained in:
Yisroel Baum 2026-08-10 23:21:45 +03:00
parent d9e2acd808
commit 34f3bd5c44
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 11 additions and 2 deletions

View file

@ -1,5 +1,10 @@
{ pkgs }:
let
stylesheetHash = builtins.substring 0 12 (builtins.hashFile "sha256" ../site/styles.css);
stylesheetFileName = "styles-${stylesheetHash}.css";
in
pkgs.stdenvNoCC.mkDerivation {
pname = "tide-landing-page";
version = "1.0.0";
@ -12,6 +17,11 @@ pkgs.stdenvNoCC.mkDerivation {
mkdir -p "$out"
cp -R . "$out"
mv "$out/styles.css" "$out/${stylesheetFileName}"
substituteInPlace "$out/index.html" \
--replace-fail \
'href="/styles.css"' \
'href="/${stylesheetFileName}"'
runHook postInstall
'';

View file

@ -25,8 +25,7 @@ let
};
evaluatedConfig = evaluatedSystem.config;
landingPage = self.packages.${system}.landing-page;
stylesheetHash =
builtins.substring 0 12 (builtins.hashFile "sha256" ../../site/styles.css);
stylesheetHash = builtins.substring 0 12 (builtins.hashFile "sha256" ../../site/styles.css);
stylesheetFileName = "styles-${stylesheetHash}.css";
landingVirtualHost = evaluatedConfig.services.nginx.virtualHosts."torahimderecheretz.com";
discourseConfig = evaluatedConfig.services.discourse;