Do not add CSS shorthands in runtime
See original GitHub issueWe don’t allow to use CSS shorthands: https://github.com/microsoft/griffel/blob/b4c7acc77e5e7b4883ca32249418a3d93dc43e77/packages/core/src/types.ts#L5-L49
We should implement something in runtime to prevent adding rules with shorthands. Currently shorthands usage produces TS errors, but rules are still inserted to DOM. That creates confusion and feeling that something is wrong with typings.
- This should be based on typings that we have
- The runtime check should be development (non-production) to avoid contributions to bundle size
Expected behavior
import { makeStyles } from "@griffel/react";
const useClasses = makeStyles({
root: {
// ⏭ "background" is not inserted to DOM & a warning is produced (currently inserted)
// 💥 produces TS error (already done)
background: "red"
}
});
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
The Beginner's Guide to CSS Shorthand - HubSpot Blog
Not all CSS properties can be written in shorthand, but some important ones can. In this post, we'll define what CSS shorthand is...
Read more >Leaving certain values unchanged when using CSS ...
You'll have to stick with assigning margin-top and margin-bottom respectively. A shorthand property always changes the values of all its ...
Read more >The Shorthand-Longhand Problem in Atomic CSS
The first and most obvious solution is to just not use shorthand properties at all. Doing that, we completely eliminate the problem. The...
Read more >Decompose shorthand/compound styles to their constituent ...
I have some buttons in a nav with a default padding value: var style = { padding: '10px 20px' } When selected, I...
Read more >Shorthand properties - CSS: Cascading Style Sheets | MDN
Shorthand properties are CSS properties that let you set the values of multiple other CSS properties simultaneously.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This looks really strange. Can you please share details about your environment? OS, browser?
@Aloento you find out more details in that comment, https://github.com/microsoft/griffel/issues/30#issuecomment-1045959297. If you have questions, let’s continue there.