we don't have to commit styles.css, actually
Some checks failed
arche-build-and-publish / gractwo-arche-build-test (push) Failing after 8s

This commit is contained in:
2026-04-08 00:45:13 +02:00
parent 6613ccb239
commit 83591fbcb0
4 changed files with 13 additions and 14 deletions

View File

@@ -10,14 +10,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
if std::env::var("IN_DOCKER").is_err() { if std::env::var("IN_DOCKER").is_err() {
let os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_else(|_| String::from("unknown")); let os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_else(|_| String::from("unknown"));
let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_else(|_| String::from("unknown")); let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_else(|_| String::from("unknown"));
let download_url = match (os.as_str(), arch.as_str()) { let env = env::var("CARGO_CFG_TARGET_ENV").unwrap_or_else(|_| String::from("unknown"));
("macos", "aarch64") => { let download_url = match (os.as_str(), arch.as_str(), env.as_str()) {
("macos", "aarch64", _) => {
"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-macos-arm64" "https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-macos-arm64"
} }
("linux", "x86_64") => { ("linux", "x86_64", "musl") => {
"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64-musl"
}
("linux", "x86_64", _) => {
"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64" "https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64"
} }
("linux", "aarch64") => { ("linux", "aarch64", "musl") => {
"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-arm64-musl"
}
("linux", "aarch64", _) => {
"https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-arm64" "https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-arm64"
} }
_ => return Err(format!("Unsupported platform: {} {}", os, arch).into()), _ => return Err(format!("Unsupported platform: {} {}", os, arch).into()),
@@ -40,7 +47,7 @@ fn run_tailwind(bin: &PathBuf) -> Result<(), Box<dyn std::error::Error>> {
let basedir = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".into()); let basedir = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".into());
let input = Path::new(&basedir).join("web").join("input.css"); let input = Path::new(&basedir).join("web").join("input.css");
let inputstr = input.to_str().unwrap(); let inputstr = input.to_str().unwrap();
let output = Path::new(&basedir).join("web").join("styles.css"); let output = PathBuf::from(env::var("OUT_DIR")?).join("styles.css");
let outputstr = output.to_str().unwrap(); let outputstr = output.to_str().unwrap();
let args = vec!["-i", inputstr, "-o", outputstr, "--minify"]; let args = vec!["-i", inputstr, "-o", outputstr, "--minify"];

View File

@@ -1,8 +1,2 @@
arche arche
===== =====
Regarding /web/styles.css
The styles.css file, which is generated by a standalone Tailwind binary downloaded and executed automatically within build.rs, is to be committed any time it changes, as without it styling will be broken on the frontend part of the page.
This is in contrast to a perhaps expected approach of gitignoring them and just generating them every build; this is incompatible with building docker images in an efficient way, however, as docker exposes no way to mount directories while retaining ability to write files and execute binaries.

View File

@@ -10,7 +10,7 @@ use crate::website::pages::{index::page_index, notfound::page_notfound};
mod pages; mod pages;
const STYLES_CSS: &str = include_str!("../../web/styles.css"); const STYLES_CSS: &str = include_str!(concat!(env!("OUT_DIR"), "/styles.css"));
const FAVICON_SVG: &str = include_str!("../../assets/logo.svg"); const FAVICON_SVG: &str = include_str!("../../assets/logo.svg");
const FAVICON_X64: &[u8] = include_bytes!("../../assets/logo-x64.png"); const FAVICON_X64: &[u8] = include_bytes!("../../assets/logo-x64.png");

File diff suppressed because one or more lines are too long