From 2c6987acb6b4e46db2f0cbc9cd970de8449c4b14 Mon Sep 17 00:00:00 2001 From: Karim Semmoud Date: Wed, 7 Oct 2026 20:41:24 +0700 Subject: [PATCH] Version site.css and site.js URLs in production builds Co-authored-by: Cursor --- CHANGELOG.md | 4 ++++ config/prod.exs | 7 +++++++ lib/layouts/root_layout.ex | 4 ++-- lib/soonex/public.ex | 7 +++++++ mix.exs | 2 +- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65b2241..8d00fe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.3.1 + +- Version `site.css` and `site.js` URLs in production builds (`?v=` plus the commit SHA, or the build time outside GitHub Actions) so visitors get new styles after a deploy without a hard refresh. + ## 0.3.0 - Redesign the home page with an editorial layout: display-size hero with a photo stage and floating countdown, photo-backed live preview, capabilities bento grid, workflow tabs with steps and copy commands, a proof section with stats, image-led journal cards, FAQ, and a closing waitlist band over photography. diff --git a/config/prod.exs b/config/prod.exs index 6cf5a9f..3117883 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -16,7 +16,14 @@ public_path_prefix = p -> String.trim_trailing(p, "/") end +asset_version = + case System.get_env("GITHUB_SHA") do + sha when is_binary(sha) and sha != "" -> String.slice(sha, 0, 12) + _ -> Integer.to_string(System.os_time(:second)) + end + config :soonex, :public_path_prefix, public_path_prefix +config :soonex, :asset_version, asset_version config :tableau, :config, url: site_url config :tableau, Tableau.PostExtension, future: false, dir: ["_posts"] config :tableau, Tableau.PageExtension, dir: ["_pages"] diff --git a/lib/layouts/root_layout.ex b/lib/layouts/root_layout.ex index b58d15d..b993f59 100644 --- a/lib/layouts/root_layout.ex +++ b/lib/layouts/root_layout.ex @@ -146,8 +146,8 @@ defmodule Soonex.RootLayout do type="font/woff2" crossorigin /> - -