Skip to content

Commit

Permalink
feat: add background position plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Dec 5, 2022
1 parent d1b2300 commit 50cb275
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/tailwind-config/src/lib.rs
Expand Up @@ -89,6 +89,8 @@ pub struct TailwindTheme<'a> {
pub background_image: HashMap<&'a str, &'a str>,
#[serde(borrow, alias = "backgroundSize")]
pub background_size: HashMap<&'a str, &'a str>,
#[serde(borrow, alias = "backgroundPosition")]
pub background_position: HashMap<&'a str, &'a str>,

#[serde(borrow, rename = "gridTemplateRows")]
pub grid_template_rows: HashMap<&'a str, &'a str>,
Expand Down
1 change: 1 addition & 0 deletions crates/tailwind-parse/src/eval/plugin.rs
Expand Up @@ -445,6 +445,7 @@ pub fn bg(val: &SubjectValue, theme: &TailwindTheme) -> Option<ObjectLit> {
SubjectValue::Value(Value(rest)) => simple_lookup(&theme.colors, rest, "backgroundColor")
.or_else(|| simple_lookup(&theme.background_image, rest, "backgroundImage"))
.or_else(|| simple_lookup(&theme.background_size, rest, "backgroundSize"))
.or_else(|| simple_lookup(&theme.background_position, rest, "backgroundPosition"))
SubjectValue::Css(Css(css)) => Some(to_lit(&[("background", css)])),
}
}
Expand Down

0 comments on commit 50cb275

Please sign in to comment.