(build): Introduce nuevas funciones de build

Añade `compile_scss()`, `copy_dir()`, `copy_file()`,
`copy_file_replacing()` y `minify_js()` para preparar activos en
`build.rs`. Adopta el patrón `assets/ -> static/`: los archivos
estáticos se mueven a `assets/` y `static/` se añade a `.gitignore`. Los
`build.rs` de *pagetop* y *pagetop-htmx* se actualizan con el nuevo
patrón.  La documentación del módulo se reescribe para reflejar los
nuevos cambios.
This commit is contained in:
Manuel Cillero 2026-06-14 21:18:54 +02:00
parent 6376e3e88c
commit f27790c3a2
26 changed files with 468 additions and 236 deletions

View file

@ -1,6 +1,12 @@
use pagetop_build::StaticFilesBundle;
use pagetop_build::{StaticFilesBundle, copy_dir};
fn main() -> std::io::Result<()> {
// Regenera `static/` desde cero sólo si hay cambios en `assets/`.
println!("cargo:rerun-if-changed=assets");
let _ = std::fs::remove_dir_all("static");
copy_dir("assets", "static")?;
StaticFilesBundle::from_dir("./static", None)
.with_name("htmx")
.build()

View file

@ -148,7 +148,7 @@ async fn example() -> Result<(), DbErr> {
*/
#![doc(
html_favicon_url = "https://git.cillero.es/manuelcillero/pagetop/raw/branch/main/static/favicon.ico"
html_favicon_url = "https://git.cillero.es/manuelcillero/pagetop/raw/branch/main/assets/favicon.ico"
)]
use pagetop::prelude::*;