Replies: 2 comments
-
@DanTsk Yeah this is something we've got in mind at the moment. Keen to hear a bit more about what your expectations are though. PS: I've converted your initial issue into a Github Discussion. |
Beta Was this translation helpful? Give feedback.
-
@peduarte In my opinion, it can be implemented pretty easily using babel plugin/preset with babel macros under the hood. Babel is the right choice, as it allows functionality to be bundler/builder agnostic. Extraction flow is pretty simple:
Simple example (Modified example from const Button = styled('button', {
backgroundColor: 'gainsboro',
fontSize: '13px',
borderRadius: getBorderRadius(),
':hover': {
transform: 'translateY(-2px)',
boxShadow: getBoxShadow()
},
}); will be compiled to the following representation const Button = __stitches__extracted_styled('button', '_fEDayN _eJromA _jWObkk scid-gtKRhv', {
borderRadius: getBorderRadius(),
':hover': {
boxShadow: getBoxShadow()
},
}); The same strategy must be applied to variants. Also, such a plugin can improve DX for styling react components. Instead of explicitly defining the |
Beta Was this translation helpful? Give feedback.
-
It looks like
stitches
can be extended with a static CSS extraction feature to improve performance even more. With variants (no direct interpolation\parametrization), all CSS scope for the certain component can be easily extracted.I'm not talking about full extraction, but extraction for only
styled
components (that are most common) will increase performance a lot.Beta Was this translation helpful? Give feedback.
All reactions