Skip to content

Commit

Permalink
feat: make flex plugin support arbitrary CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Feb 20, 2023
1 parent f7df759 commit ca48c18
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions crates/tailwind-parse/src/eval/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,7 @@ pub fn ring<'a>(rest: Option<&Value>, theme: &'a TailwindTheme) -> PluginResult<
}
}

lookup_plugin_opt!(flex_grow, flex_grow, "flexGrow");
lookup_plugin_opt!(flex_shrink, flex_shrink, "flexShrink");
lookup_plugin_arbitrary!(flex_inner, flex, "flex");

pub fn flex<'a>(
f: Option<Flex>,
Expand All @@ -628,9 +627,9 @@ pub fn flex<'a>(
(Some(Flex::WrapReverse), _) => [("flexWrap", "wrap-reverse")],
(Some(Flex::NoWrap), _) => [("flexWrap", "nowrap")],
(None, None) => [("display", "flex")],
(Some(Flex::Grow), v) => return flex_grow(v.as_ref().and_then(|s| s.value()), theme),
(Some(Flex::Shrink), v) => return flex_shrink(v.as_ref().and_then(|s| s.value()), theme),
(None, Some(val)) => return simple_lookup(&theme.flex, val.as_str(), "flex"),
(Some(Flex::Grow), v) => return grow(v, theme),
(Some(Flex::Shrink), v) => return shrink(v, theme),
(None, Some(val)) => return flex_inner(val, theme),
};

Ok(to_lit(&rule))
Expand Down

0 comments on commit ca48c18

Please sign in to comment.