Skip to content

Commit

Permalink
fix: improve suggestion in text plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Dec 25, 2022
1 parent 1be52de commit 497a8b1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crates/tailwind-parse/src/eval/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ array_plugin!(
);
lookup_plugin_arbitrary!(text_color, colors, "color");
lookup_plugin_arbitrary!(text_size, font_size, "fontSize", |t| t.0.to_string());
merge_plugins_arbitrary!(text_base, text_color, text_size);

array_plugin!(appearance, ["none"], "appearance");

Expand Down Expand Up @@ -485,12 +486,12 @@ pub fn transform_origin<'a>(Value(rest): &Value, _theme: &'a TailwindTheme) -> P
}

pub fn text<'a>(value: &SubjectValue, theme: &'a TailwindTheme) -> PluginResult<'a> {
text_size(value, theme)
.or_else(|_e| text_color(value, theme))
.or_else(|e| match value {
SubjectValue::Value(v) => text_align(v, theme),
SubjectValue::Css(_) => Err(e),
})
text_base(value, theme).or_else(|e| match value {
SubjectValue::Value(v) => {
text_align(v, theme).map_err(|e2| e.into_iter().chain(e2).collect())
}
SubjectValue::Css(_) => Err(e),
})
}

pub fn space<'a>(Value(rest): &Value, theme: &'a TailwindTheme) -> PluginResult<'a> {
Expand Down

0 comments on commit 497a8b1

Please sign in to comment.