Skip to content

Commit

Permalink
Support aribitrary @supports modifier e.g [@supports(display:grid)]:grid
Browse files Browse the repository at this point in the history
  • Loading branch information
Oyelowo committed Oct 10, 2023
1 parent 1d31915 commit 219a918
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions tailwind/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ bg-[--my-color]
group-[:nth-of-type(3)_&]:block
[&_p]:mt-4
flex [@supports(display:grid)]:grid
"#
);
println!("TEXT - {}", test);
Expand Down
10 changes: 9 additions & 1 deletion tw-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,15 @@ fn arbitrary_back_selector_modifier(input: &str) -> IResult<&str, ()> {
Ok((input, ()))
}

// [@supports(display:grid)]:grid
fn arbitrary_at_supports_rule_modifier(input: &str) -> IResult<&str, ()> {
let (input, _) = tag("[@supports(")(input)?;
let (input, _) = take_until(")")(input)?;
let (input, _) = tag(")]")(input)?;
Ok((input, ()))
}

//
// flex [@supports(display:grid)]:grid
// [@media(any-hover:hover){&:hover}]:opacity-100
// group/edit invisible hover:bg-slate-200 group-hover/item:visible
// hidden group-[.is-published]:block
Expand Down Expand Up @@ -856,6 +863,7 @@ fn modifier(input: &str) -> IResult<&str, ()> {
alt((
arbitrary_front_selector_modifier,
arbitrary_back_selector_modifier,
arbitrary_at_supports_rule_modifier,
predefined_modifier,
))(input)
}
Expand Down

0 comments on commit 219a918

Please sign in to comment.