File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222- Ensure utilities are sorted based on their actual property order ([ #16995 ] ( https://github.com/tailwindlabs/tailwindcss/pull/16995 ) )
2323- Ensure strings in Pug and Slim templates are handled correctly ([ #17000 ] ( https://github.com/tailwindlabs/tailwindcss/pull/17000 ) )
2424- Ensure ` } ` and ` { ` are valid boundary characters when extracting candidates ([ #17001 ] ( https://github.com/tailwindlabs/tailwindcss/pull/17001 ) )
25+ - Add ` razor ` /` cshtml ` pre processing ([ #17027 ] ( https://github.com/tailwindlabs/tailwindcss/pull/17027 ) )
2526
2627## [ 4.0.11] - 2025-03-06
2728
Original file line number Diff line number Diff line change 11pub mod pre_processor;
22pub mod pug;
3+ pub mod razor;
34pub mod ruby;
45pub mod slim;
56pub mod svelte;
67
78pub use pre_processor:: * ;
89pub use pug:: * ;
10+ pub use razor:: * ;
911pub use ruby:: * ;
1012pub use slim:: * ;
1113pub use svelte:: * ;
Original file line number Diff line number Diff line change 1+ use crate :: extractor:: pre_processors:: pre_processor:: PreProcessor ;
2+ use bstr:: ByteSlice ;
3+
4+ #[ derive( Debug , Default ) ]
5+ pub struct Razor ;
6+
7+ impl PreProcessor for Razor {
8+ fn process ( & self , content : & [ u8 ] ) -> Vec < u8 > {
9+ content. replace ( "@@" , " @" )
10+ }
11+ }
12+
13+ #[ cfg( test) ]
14+ mod tests {
15+ use super :: Razor ;
16+ use crate :: extractor:: pre_processors:: pre_processor:: PreProcessor ;
17+
18+ #[ test]
19+ fn test_razor_pre_processor ( ) {
20+ let ( input, expected) = (
21+ r#"<div class="@@sm:text-red-500">"# ,
22+ r#"<div class=" @sm:text-red-500">"# ,
23+ ) ;
24+ Razor :: test ( input, expected) ;
25+ Razor :: test_extract_contains ( input, vec ! [ "@sm:text-red-500" ] ) ;
26+ }
27+ }
Original file line number Diff line number Diff line change @@ -468,6 +468,7 @@ pub fn pre_process_input(content: &[u8], extension: &str) -> Vec<u8> {
468468 use crate :: extractor:: pre_processors:: * ;
469469
470470 match extension {
471+ "cshtml" | "razor" => Razor . process ( content) ,
471472 "pug" => Pug . process ( content) ,
472473 "rb" | "erb" => Ruby . process ( content) ,
473474 "slim" => Slim . process ( content) ,
You can’t perform that action at this time.
0 commit comments