You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a value without a leading 0 for a box shadow the color won't be changed.
I took a shot at rewriting parseBoxShadowValue to get it to work because it seemed like a fun one to play around with. Ran the tests and it all passed. Didn't want to create a PR incase you had quicker, better fixes.
letKEYWORDS=['inset','inherit','initial','revert','unset']letCOMMA=/\,(?![^(]*\))/g// Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.letSPACE=/\ +(?![^(]*\))/g// Similar to the one above, but with spaces instead.functionparseBoxShadowValue(input){letshadows=input.split(COMMA)returnshadows.map(shadow=>{letvalue=shadow.trim()letparts=value.split(SPACE)letoutput={raw: value,valid: true}// A box-shadow requires at least 3 parts.if(parts.length<3){output.valid=falsereturnoutput}// The color is always at the end, also a color can't start with a number or a .if(/^[\d.]/.test(parts[parts.length-1])){output.valid=falsereturnoutput}if(KEYWORDS.includes(parts[0])){output.keyword=parts.shift()}output.color=parts.pop()output.x=parts.shift()output.y=parts.shift()output.blur=parts.shift()output.spread=parts.shift()output.unknown=partsreturnoutput})}
The text was updated successfully, but these errors were encountered:
crswll
changed the title
Units without leading 0s cause shadow color to not work.
Units without leading 0s causes shadow color to not work.
Jan 23, 2022
What version of Tailwind CSS are you using?
3.0.14
What build tool (or framework if it abstracts the build tool) are you using?
Play
What version of Node.js are you using?
N/A
What browser are you using?
Chrome
What operating system are you using?
macOS
Reproduction URL
https://play.tailwindcss.com/sgiL9df2gw?file=config
Describe your issue
When using a value without a leading 0 for a box shadow the color won't be changed.
I took a shot at rewriting
parseBoxShadowValue
to get it to work because it seemed like a fun one to play around with. Ran the tests and it all passed. Didn't want to create a PR incase you had quicker, better fixes.The text was updated successfully, but these errors were encountered: