Skip to content

Commit

Permalink
feat: add aspect plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Jan 19, 2023
1 parent ecf7d4e commit 2eaecc3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/tailwind-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ pub struct TailwindTheme<'a> {
pub line_height: HashMap<&'a str, &'a str>,
#[serde(borrow, alias = "animation")]
pub animation: HashMap<&'a str, &'a str>,

#[serde(borrow, alias = "aspectRatio")]
pub aspect_ratio: HashMap<&'a str, &'a str>,
}

#[derive(Deserialize, Debug)]
Expand Down
2 changes: 2 additions & 0 deletions crates/tailwind-parse/src/eval/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ pub fn truncate() -> ObjectLit {
])
}

lookup_plugin_arbitrary!(aspect, aspect_ratio, "aspectRatio");

pub fn outline<'a>(rest: Option<&Value>, theme: &'a TailwindTheme) -> PluginResult<'a> {
match rest {
None => Ok(to_lit(&[("outlineStyle", "solid")])),
Expand Down
1 change: 1 addition & 0 deletions crates/tailwind-parse/src/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ impl<'a> Literal<'a> {
From => Required(plugin::from),
To => Required(plugin::to),
Outline => Optional(plugin::outline),
Aspect => RequiredArbitrary(plugin::aspect),
Mix => Required(plugin::mix),
Content => RequiredArbitrary(plugin::content),
Grow => Optional(plugin::grow),
Expand Down
1 change: 1 addition & 0 deletions crates/tailwind-parse/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ mod plugin {
Truncate,
Animate,
Pointer,
Aspect,
Ease,
Order,
Whitespace(Whitespace),
Expand Down

0 comments on commit 2eaecc3

Please sign in to comment.