Skip to content

Commit

Permalink
add scale plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Aug 19, 2022
1 parent a0a81fb commit cfd6449
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 @@ -23,6 +23,8 @@ pub struct TailwindTheme<'a> {
#[serde(borrow)]
pub cursor: HashMap<&'a str, &'a str>,
#[serde(borrow)]
pub scale: HashMap<&'a str, &'a str>,
#[serde(borrow)]
pub colors: HashMap<&'a str, &'a str>,
#[serde(borrow, alias = "fontFamily")]
pub font_family: HashMap<&'a str, Vec<Cow<'a, str>>>,
Expand Down
1 change: 1 addition & 0 deletions src/parse/literal.rs
Expand Up @@ -16,6 +16,7 @@ pub fn parse_literal<'a>(theme: &TailwindTheme, s: &'a str) -> Result<ObjectLit,
"border" => plugin::border,
"rounded" => plugin::rounded,
"cursor" => plugin::cursor,
"scale" => plugin::scale,
"bg" => plugin::bg,
"h" => plugin::h,
"w" => plugin::w,
Expand Down
4 changes: 4 additions & 0 deletions src/plugin.rs
Expand Up @@ -98,6 +98,10 @@ pub fn cursor(rest: &str, theme: &TailwindTheme) -> Option<ObjectLit> {
simple_lookup(&theme.cursor, rest, "cursor")
}

pub fn scale(rest: &str, theme: &TailwindTheme) -> Option<ObjectLit> {
simple_lookup_map(&theme.scale, rest, "transform", |v| format!("scale({})", v))
}

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

0 comments on commit cfd6449

Please sign in to comment.