Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ensure utilities are sorted based on their actual property order ([#16995](https://github.com/tailwindlabs/tailwindcss/pull/16995))
- Ensure strings in Pug and Slim templates are handled correctly ([#17000](https://github.com/tailwindlabs/tailwindcss/pull/17000))
- Ensure `}` and `{` are valid boundary characters when extracting candidates ([#17001](https://github.com/tailwindlabs/tailwindcss/pull/17001))
- Add `razor`/`cshtml` pre processing ([#17027](https://github.com/tailwindlabs/tailwindcss/pull/17027))

## [4.0.11] - 2025-03-06

Expand Down
2 changes: 2 additions & 0 deletions crates/oxide/src/extractor/pre_processors/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
pub mod pre_processor;
pub mod pug;
pub mod razor;
pub mod ruby;
pub mod slim;
pub mod svelte;

pub use pre_processor::*;
pub use pug::*;
pub use razor::*;
pub use ruby::*;
pub use slim::*;
pub use svelte::*;
27 changes: 27 additions & 0 deletions crates/oxide/src/extractor/pre_processors/razor.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use crate::extractor::pre_processors::pre_processor::PreProcessor;
use bstr::ByteSlice;

#[derive(Debug, Default)]
pub struct Razor;

impl PreProcessor for Razor {
fn process(&self, content: &[u8]) -> Vec<u8> {
content.replace("@@", " @")
}
}

#[cfg(test)]
mod tests {
use super::Razor;
use crate::extractor::pre_processors::pre_processor::PreProcessor;

#[test]
fn test_razor_pre_processor() {
let (input, expected) = (
r#"<div class="@@sm:text-red-500">"#,
r#"<div class=" @sm:text-red-500">"#,
);
Razor::test(input, expected);
Razor::test_extract_contains(input, vec!["@sm:text-red-500"]);
}
}
1 change: 1 addition & 0 deletions crates/oxide/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ pub fn pre_process_input(content: &[u8], extension: &str) -> Vec<u8> {
use crate::extractor::pre_processors::*;

match extension {
"cshtml" | "razor" => Razor.process(content),
Copy link
Member Author

Choose a reason for hiding this comment

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

"pug" => Pug.process(content),
"rb" | "erb" => Ruby.process(content),
"slim" => Slim.process(content),
Expand Down