We're excited to release Stylex v0.5.0 with some big improvements and fixes!
New attrs function
The props function returns an object with a className string and a
style object. Some frameworks may expect class instead of className and a
string value for style.
We are introducing a new attrs function so StyleX works well in more
places. attrs returns an object with a class string and a style
string.
New sort-keys rule for the Eslint plugin
A new @stylexjs/sort-keys plugin has been introduced which will sort styles
alphabetically and by priority. This will make media query order more
predictable.
Thanks @nedjulius!
New aliases option for the StyleX Babel plugin
A new aliases field can be used to configure StyleX to resolve custom aliases
that may be set up in your tsconfig file. NOTE: StyleX currently needs to
be configured with absolute paths for your aliases.
Thanks @rayan1810!
New Esbuild plugin
A new official plugin for Esbuild has been introduced as
@stylexjs/esbuild-plugin.
Thanks @nedjulius!
Other Enhancements
- Configuration options passed to the StyleX Babel plugin will now be validated.
- The
@stylexjs/stylexnow has ESM exports alongside the commonJS exports. - The ESLint
valid-stylesrule will catch when using empty strings as string values.
Bug Fixes
- Some CSS properties which previously caused type and lint errors will now be accepted.
- Using variables for
opacitywill no longer cause type errors. - Using
keyframeswithindefineVarswill now work correctly runtimeInjectionwill correctly be handled- Setting the value of variables from
defineVarsas dynamic styles will now work correctly. - Usage of
0pxwithin CSS functions will no longer be simplified to a unit-less0as this doesn't work in certain cases. - Spaces around CSS operators will be maintained.
In addition to these, we've added an "Ecosystem" page to our website to highlight various community projects around StyleX.
