razor.rs — tailwindcss Source File
Architecture documentation for razor.rs, a rust file in the tailwindcss codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 43c79a43_9190_869e_b719_f96050481838["razor.rs"] 7ab18a53_b4f7_a257_09be_4f1ad7f9cde7["super::Razor"] 43c79a43_9190_869e_b719_f96050481838 --> 7ab18a53_b4f7_a257_09be_4f1ad7f9cde7 ed5b6564_5e78_f7bf_cdc6_b0150d9116c1["crate::extractor::pre_processors::pre_processor::PreProcessor"] 43c79a43_9190_869e_b719_f96050481838 --> ed5b6564_5e78_f7bf_cdc6_b0150d9116c1 092d26da_8f74_08d1_48f1_765b79ca447c["bstr::ByteSlice"] 43c79a43_9190_869e_b719_f96050481838 --> 092d26da_8f74_08d1_48f1_765b79ca447c style 43c79a43_9190_869e_b719_f96050481838 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
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("@@", " @").replace(r#"@("@")"#, " @")
}
}
#[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"]);
}
// https://github.com/tailwindlabs/tailwindcss/issues/17424
#[test]
fn test_razor_syntax_with() {
let (input, expected) = (
r#"<p class="@("@")md:bg-red-500 @@md:border-green-500 border-8">With 2 elements</p>"#,
r#"<p class=" @md:bg-red-500 @md:border-green-500 border-8">With 2 elements</p>"#,
);
Razor::test(input, expected);
Razor::test_extract_contains(
input,
vec!["@md:bg-red-500", "@md:border-green-500", "border-8"],
);
}
}
Domain
Subdomains
Dependencies
- bstr::ByteSlice
- crate::extractor::pre_processors::pre_processor::PreProcessor
- super::Razor
Source
Frequently Asked Questions
What does razor.rs do?
razor.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the Oxide domain, PreProcessors subdomain.
What functions are defined in razor.rs?
razor.rs defines 3 function(s): process, test_razor_pre_processor, test_razor_syntax_with.
What does razor.rs depend on?
razor.rs imports 3 module(s): bstr::ByteSlice, crate::extractor::pre_processors::pre_processor::PreProcessor, super::Razor.
Where is razor.rs in the architecture?
razor.rs is located at crates/oxide/src/extractor/pre_processors/razor.rs (domain: Oxide, subdomain: PreProcessors, directory: crates/oxide/src/extractor/pre_processors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free