Skip to content

feat(css): Handle bundling CSS ourselves#98

Merged
Princesseuh merged 3 commits intomainfrom
fix/bundling-css
Mar 17, 2026
Merged

feat(css): Handle bundling CSS ourselves#98
Princesseuh merged 3 commits intomainfrom
fix/bundling-css

Conversation

@Princesseuh
Copy link
Copy Markdown
Member

Fixes #

What does this change?

  • Be short and concise. Bullet points can help!
  • Before/after screenshots can help as well.

How is it tested?

How is it documented?

@sampo-s-bot
Copy link
Copy Markdown

sampo-s-bot bot commented Mar 16, 2026

🧭 Changeset detected

Merging this PR will release the following updates:

maudit (Cargo) — patch version bump

Patch changes

  • Adds support for Rolldown 1.0 RC

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 16, 2026

Deploy Preview for maudit-framework ready!

Name Link
🔨 Latest commit c436ff3
🔍 Latest deploy log https://app.netlify.com/projects/maudit-framework/deploys/69b8c170b2c5f9000830f896
😎 Deploy Preview https://deploy-preview-98--maudit-framework.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the crt:maudit Changes in Maudit crate. label Mar 16, 2026
@Princesseuh Princesseuh requested a review from Copilot March 17, 2026 01:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR shifts CSS handling away from rolldown plugins toward an in-crate CSS pipeline (Tailwind CLI pre-processing + lightningcss bundling/minification), alongside dependency upgrades needed to support that change.

Changes:

  • Upgrade brk_rolldown / brk_rolldown_plugin_replace to 1.0.0-rc.7 and bump rust-version.
  • Replace the rolldown-based Tailwind transform plugin with a direct run_tailwind helper and process CSS via new bundle_css (lightningcss).
  • Update the build pipeline to generate CSS outputs separately from JS bundling and keep incremental stale-bundle cleanup.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
xtask/Cargo.toml Bumps rolldown dependency version for xtask tooling.
crates/maudit/src/build.rs Switches asset generation to lightningcss for CSS + Tailwind CLI, rolldown for JS, and adjusts incremental cache behavior.
crates/maudit/src/assets/tailwind.rs Replaces Tailwind rolldown plugin with a CLI helper returning processed CSS.
crates/maudit/src/assets/css.rs Adds lightningcss-based CSS bundling + URL-rewriting/copying for referenced assets.
crates/maudit/src/assets.rs Wires in the new CSS module and re-exports Tailwind helper.
crates/maudit/Cargo.toml Updates rust-version, rolldown deps, and adds lightningcss.
Cargo.lock Lockfile updates for the dependency changes (rolldown + lightningcss and transitive deps).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +85 to +89
pub fn bundle_css(
entry: &Path,
source_css: Option<&str>,
minify: bool,
output_dir: &Path,
Comment on lines +53 to +54
let hash =
calculate_hash(&source_path, None).expect("failed to hash CSS-referenced asset");
Comment on lines +49 to +66
if let Ok(source_path) = source_path.canonicalize()
&& source_path.is_file()
{
// Hash the file contents for fingerprinting
let hash =
calculate_hash(&source_path, None).expect("failed to hash CSS-referenced asset");

let extension = source_path.extension().and_then(|e| e.to_str());
let fingerprinted = make_filename(&source_path, &hash, extension);
let dest_path = self.output_dir.join(&fingerprinted);

if let Err(e) = fs::copy(&source_path, &dest_path) {
debug!(
"Failed to copy asset {:?} to {:?}: {}",
source_path, dest_path, e
);
return Ok(());
}
Comment on lines +121 to +122
let fs = FileProvider::new();
let mut bundler = Bundler::new(&fs, None, ParserOptions::default());
Comment on lines +1121 to +1126
let css = bundle_css(
style.path(),
tailwind_output.as_deref(),
should_minify,
&route_assets_options.output_assets_dir,
)?;
Comment on lines +1100 to +1104
// Process CSS files with lightningcss (with optional Tailwind pre-processing)
if !build_pages_styles.is_empty() {
let should_minify = !is_dev();

for style in &build_pages_styles {
@Princesseuh Princesseuh marked this pull request as ready for review March 17, 2026 11:19
@Princesseuh Princesseuh merged commit 786e7be into main Mar 17, 2026
11 checks passed
@Princesseuh Princesseuh deleted the fix/bundling-css branch March 17, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crt:maudit Changes in Maudit crate.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants