Skip to content

Commit

Permalink
feat: add shrink plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Aug 19, 2022
1 parent 461c8c6 commit 464473d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/config.rs
Expand Up @@ -24,6 +24,8 @@ pub struct TailwindTheme<'a> {
pub cursor: HashMap<&'a str, &'a str>,
#[serde(borrow)]
pub flex: HashMap<&'a str, &'a str>,
#[serde(borrow, alias = "flexShrink")]
pub flex_shrink: HashMap<&'a str, &'a str>,
#[serde(borrow)]
pub gap: HashMap<&'a str, &'a str>,
#[serde(borrow)]
Expand Down
1 change: 1 addition & 0 deletions src/parse/literal.rs
Expand Up @@ -22,6 +22,7 @@ pub fn parse_literal<'a>(theme: &TailwindTheme, s: &'a str) -> Result<ObjectLit,
"border" => plugin::border,
"rounded" => plugin::rounded,
"flex" => plugin::flex,
"shrink" => plugin::shrink,
"gap" => plugin::gap,
"cursor" => plugin::cursor,
"scale" => plugin::scale,
Expand Down
4 changes: 4 additions & 0 deletions src/plugin.rs
Expand Up @@ -105,6 +105,10 @@ pub fn flex(rest: &str, theme: &TailwindTheme) -> Option<ObjectLit> {
.or_else(|| simple_lookup(&theme.flex, rest, "flex"))
}

pub fn shrink(rest: &str, theme: &TailwindTheme) -> Option<ObjectLit> {
simple_lookup(&theme.flex_shrink, rest, "flexShrink")
}

pub fn gap(rest: &str, theme: &TailwindTheme) -> Option<ObjectLit> {
simple_lookup(&theme.gap, rest, "gap")
}
Expand Down

0 comments on commit 464473d

Please sign in to comment.