brk: fix bundler use + bundler: remove minify html crate

This commit is contained in:
nym21
2025-06-15 12:39:50 +02:00
parent ae6aa4088b
commit 6a9ac9b025
10 changed files with 127 additions and 606 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "brk_bundler"
description = "A crate that bundles the selected website for the server"
description = "A thin wrapper around rolldown"
version.workspace = true
edition.workspace = true
license.workspace = true
@@ -9,7 +9,6 @@ repository.workspace = true
[dependencies]
log = { workspace = true }
minify-html-onepass = "0.16.4"
notify = "8.0.0"
brk_rolldown = "0.0.1"
sugar_path = "1.2.0"

View File

@@ -2,7 +2,6 @@ use std::{fs, io, path::Path, sync::Arc};
use brk_rolldown::{Bundler, BundlerOptions, RawMinifyOptions, SourceMapType};
use log::error;
use minify_html_onepass::Cfg;
use notify::{EventKind, RecursiveMode, Watcher};
use sugar_path::SugarPath;
use tokio::sync::Mutex;
@@ -56,15 +55,7 @@ pub async fn bundle(websites_path: &Path, source_folder: &str, watch: bool) -> i
contents = contents.replace("/scripts/main.js", &format!("/scripts/{main_hashed}.js"));
}
if let Ok(contents) = minify_html_onepass::in_place_str(
contents.as_mut_str(),
&Cfg {
minify_js: false,
minify_css: false,
},
) {
let _ = fs::write(&absolute_dist_index_path, contents);
}
let _ = fs::write(&absolute_dist_index_path, contents);
};
let write_sw = move || {