-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add inline processing for borderWidth, borderColor, borderStyle to valid-shorthands #817
Conversation
workflow: benchmarks/sizeComparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
|
const directionalProperties = [ | ||
'border-width', | ||
'border-color', | ||
'border-style', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include borderRadius
too. Is there anything else? Where is the configuration for enabling this for padding
and margin
located? Do we know if OSS users get consistent behavior across properties (it should default for physical properties for every shorthand)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the supported properties, I believe it's just these that are directional:
borderColor
borderWidth
borderStyle
borderRadius
margin
padding
marginBlock
marginInline
paddingBlock
paddingInline
And these that are left as is: (ie. we won't modify anything existing with physical properties, just expand them as is)
borderTop
borderRight
borderBottom
borderLeft
background
font
outline
There's a global config preferInline
that's set when configuring the lint rule; it's default false for all properties, so by default all properties use physical properties when this config is not set.
42f44bf
to
adaffa4
Compare
…, borderStyle to valid-shorthands (facebook#817)
…, borderStyle to valid-shorthands (facebook#817)
…, borderStyle to valid-shorthands (facebook#817)
…, borderStyle to valid-shorthands (facebook#817)
Context
When using the
preferInline
config, we were expanding margin/padding to equivalent inline logical properties. However, we overlooked applying the same transform to certain border properties.The change introduced here extends the inline logical transformation to border properties (specifically borderWidth, borderStyle, and borderColor) by applying the same logic used for margin and padding. We take the output from
css-shorthand-expand
and apply a transform to the physical properties returned.Testing
Added test expansions for borderWidth, borderStyle, and borderColor with
preferInline
set to default (false) and truePre-flight checklist
Contribution Guidelines