feat(css): Handle bundling CSS ourselves#98
Merged
Princesseuh merged 3 commits intomainfrom Mar 17, 2026
Merged
Conversation
🧭 Changeset detectedMerging this PR will release the following updates: maudit (Cargo) — patch version bumpPatch changes
|
✅ Deploy Preview for maudit-framework ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
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_replaceto1.0.0-rc.7and bumprust-version. - Replace the rolldown-based Tailwind transform plugin with a direct
run_tailwindhelper and process CSS via newbundle_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, |
crates/maudit/src/assets/css.rs
Outdated
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(()); | ||
| } |
crates/maudit/src/assets/css.rs
Outdated
Comment on lines
+121
to
+122
| let fs = FileProvider::new(); | ||
| let mut bundler = Bundler::new(&fs, None, ParserOptions::default()); |
crates/maudit/src/build.rs
Outdated
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #
What does this change?
How is it tested?
How is it documented?