fingerprint deployed stylesheet assets
This commit is contained in:
parent
d9e2acd808
commit
34f3bd5c44
2 changed files with 11 additions and 2 deletions
10
nix/site.nix
10
nix/site.nix
|
|
@ -1,5 +1,10 @@
|
||||||
{ pkgs }:
|
{ pkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
stylesheetHash = builtins.substring 0 12 (builtins.hashFile "sha256" ../site/styles.css);
|
||||||
|
stylesheetFileName = "styles-${stylesheetHash}.css";
|
||||||
|
in
|
||||||
|
|
||||||
pkgs.stdenvNoCC.mkDerivation {
|
pkgs.stdenvNoCC.mkDerivation {
|
||||||
pname = "tide-landing-page";
|
pname = "tide-landing-page";
|
||||||
version = "1.0.0";
|
version = "1.0.0";
|
||||||
|
|
@ -12,6 +17,11 @@ pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"
|
||||||
cp -R . "$out"
|
cp -R . "$out"
|
||||||
|
mv "$out/styles.css" "$out/${stylesheetFileName}"
|
||||||
|
substituteInPlace "$out/index.html" \
|
||||||
|
--replace-fail \
|
||||||
|
'href="/styles.css"' \
|
||||||
|
'href="/${stylesheetFileName}"'
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,7 @@ let
|
||||||
};
|
};
|
||||||
evaluatedConfig = evaluatedSystem.config;
|
evaluatedConfig = evaluatedSystem.config;
|
||||||
landingPage = self.packages.${system}.landing-page;
|
landingPage = self.packages.${system}.landing-page;
|
||||||
stylesheetHash =
|
stylesheetHash = builtins.substring 0 12 (builtins.hashFile "sha256" ../../site/styles.css);
|
||||||
builtins.substring 0 12 (builtins.hashFile "sha256" ../../site/styles.css);
|
|
||||||
stylesheetFileName = "styles-${stylesheetHash}.css";
|
stylesheetFileName = "styles-${stylesheetHash}.css";
|
||||||
landingVirtualHost = evaluatedConfig.services.nginx.virtualHosts."torahimderecheretz.com";
|
landingVirtualHost = evaluatedConfig.services.nginx.virtualHosts."torahimderecheretz.com";
|
||||||
discourseConfig = evaluatedConfig.services.discourse;
|
discourseConfig = evaluatedConfig.services.discourse;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue