From 0be53cf241f39230968e6b916d1aef8481ba8f9c Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 28 Mar 2025 12:01:48 +0100 Subject: [PATCH 1/3] add failing test --- .../oxide/src/extractor/pre_processors/razor.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/oxide/src/extractor/pre_processors/razor.rs b/crates/oxide/src/extractor/pre_processors/razor.rs index d77644b12e1f..a5d7ca4ef15f 100644 --- a/crates/oxide/src/extractor/pre_processors/razor.rs +++ b/crates/oxide/src/extractor/pre_processors/razor.rs @@ -24,4 +24,19 @@ mod tests { 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#"

With 2 elements

"#, + r#"

With 2 elements

"#, + ); + + Razor::test(input, expected); + Razor::test_extract_contains( + input, + vec!["@md:bg-red-500", "@md:border-green-500", "border-8"], + ); + } } From 7aa3e78daa5488c1f449679098e804e15c95f71c Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 28 Mar 2025 12:01:54 +0100 Subject: [PATCH 2/3] =?UTF-8?q?replace=20`@("@")md=E2=80=A6`=20with=20`=20?= =?UTF-8?q?=20=20=20=20@md:`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a bit of an odd one, but it's a workaround for a weird Razor quirck. Workaround mentioned here: https://github.com/dotnet/aspnetcore/issues/38595 --- crates/oxide/src/extractor/pre_processors/razor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/oxide/src/extractor/pre_processors/razor.rs b/crates/oxide/src/extractor/pre_processors/razor.rs index a5d7ca4ef15f..2713ea748b57 100644 --- a/crates/oxide/src/extractor/pre_processors/razor.rs +++ b/crates/oxide/src/extractor/pre_processors/razor.rs @@ -6,7 +6,7 @@ pub struct Razor; impl PreProcessor for Razor { fn process(&self, content: &[u8]) -> Vec { - content.replace("@@", " @") + content.replace("@@", " @").replace(r#"@("@")"#, " @") } } From 17e3986480cac0c64bd0786a10146f7e219afd9e Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 28 Mar 2025 14:09:30 +0100 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c09d68921010..b84857e62241 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix symlink issues when resolving `@source` directives ([#17391](https://github.com/tailwindlabs/tailwindcss/pull/17391)) - `@tailwindcss/cli` considers ignore rules in `--watch` mode ([#17255](https://github.com/tailwindlabs/tailwindcss/pull/17255)) - Fix negated `content` rules in legacy JavaScript configuration ([#17255](https://github.com/tailwindlabs/tailwindcss/pull/17255)) +- Extract special `@("@")md:…` syntax in Razor files ([#17427](https://github.com/tailwindlabs/tailwindcss/pull/17427)) ### Changed