Skip to content

Commit

Permalink
fix: support standalone shadow plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Nov 3, 2022
1 parent 16c023f commit 7ca223a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/parse/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn parse_literal<'a>(theme: &TailwindTheme, lit: Literal<'a>) -> Result<Obje
// all other plugins
Text => Required(plugin::text),
Font => Required(plugin::font),
Shadow => Required(plugin::shadow),
Shadow => Optional(plugin::shadow),
Transition => Optional(plugin::transition),
Placeholder => Required(plugin::placeholder),
Delay => Required(plugin::delay),
Expand Down
6 changes: 3 additions & 3 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,10 @@ pub fn bg(rest: &str, theme: &TailwindTheme) -> Option<ObjectLit> {
.or_else(|| simple_lookup(&theme.background_image, rest, "backgroundImage"))
}

pub fn shadow(rest: &str, theme: &TailwindTheme) -> Option<ObjectLit> {
pub fn shadow(rest: Option<&str>, theme: &TailwindTheme) -> Option<ObjectLit> {
theme
.box_shadow
.get(rest)
.get(rest.unwrap_or("DEFAULT"))
.map(|val| {
to_lit(&[
("boxShadow", "var(--tw-shadow)"),
Expand All @@ -336,7 +336,7 @@ pub fn shadow(rest: &str, theme: &TailwindTheme) -> Option<ObjectLit> {
])
})
.or_else(|| {
theme.colors.get(rest).map(|val| {
theme.colors.get(rest.unwrap_or("DEFAULT")).map(|val| {
to_lit(&[
("--tw-shadow-color", val),
("--tw-shadow", "var(--tw-shadow-colored)"),
Expand Down

0 comments on commit 7ca223a

Please sign in to comment.