Comments (5)
Hi @layershifter. Please take a closer look at the screenshots of FUI9 Button's computed styles, the
mergeClasses
bug @rafaeltavares identified (including multiple classNames with different values for the same style rule) can be seen in the official Button Storybook examples as well as in our product.
There is no problem with that, it's how the combination of makeResetStyles()
and makeStyles()
works 🐱
makeResetStyles()
produces a monolithic class, makeStyles()
a set of atomic that will be deduplicated in mergeClasses()
call. Classes from makeStyles()
will always win over makeResetStyles()
because of the order of appearance (that's why deduplication between makeResetStyles()
and makeStyles()
is not needed):
<style data-make-styles-bucket="r">
.reset-styles {}
</style>
<style data-make-styles-bucket="d">
.atomic-a {}
.atomic-b {}
.atomic-c {}
</style>
Here is, the example: https://codesandbox.io/s/boring-poitras-5rdxnl?file=/src/App.js
The problem is that in your stylesheet you have following (wrong order):
/* WRONG ORDER & DUPLICATION 🔴 */
.atomic-a {}
.atomic-b {}
.atomic-b {}
.atomic-c {}
.reset-styles {}
While it should be:
/* CORRECT ORDER 🟢 */
.reset-styles {}
.atomic-a {}
.atomic-b {}
.atomic-c {}
Please check suggestions from #447 (comment).
from griffel.
Rules in styles-commond_
should be sorted and deduplicated in the same way as in runtime. This looks like a problem with your setup.
Please check that you're using the latest versions of the plugin and you have proper setup (https://griffel.js.org/react/css-extraction/with-webpack), you should have GriffelCSSExtractionPlugin
in your config.
from griffel.
Hi @layershifter. Please take a closer look at the screenshots of FUI9 Button's computed styles, the mergeClasses
bug @rafaeltavares identified (including multiple classNames with different values for the same style rule) can be seen in the official Button Storybook examples as well as in our product. Note that the bug doesn't manifest in visual errors unless the Webpack Extraction Plugin is enabled, in which case the order of class names in griffel.css
appears to introduce the specificity issue.
At this point we don't have a clear repro in our own feature code so it's hard to tell how exactly to reproduce this. We suspect this is either a bug in Griffel's mergeClasses
there's some type of configuration or API misuse in the FUI9 Button code.
from griffel.
We'll investigate our webpack config, thank you!
from griffel.
Closing for now, will reopen if new details will appear.
from griffel.
Related Issues (20)
- multiple @container rules ignored (only last rule is applied) HOT 1
- core: support removing property from existing set of styles
- docs: makeStaticStyles doesn't mention it returns a React hook HOT 2
- Microsoft Learn Video Issue: Simplified Chinese and Traditional Chinese subtitles are reversed HOT 1
- devtools: provide headless mode
- feature: add support for adding prefix to CSS to scope down the styling HOT 2
- Why do class definitions get broken up into single-rule classes? HOT 1
- bug(core): missing vendor prefix (webkit) for background-clip: text HOT 1
- feature: add prefixing for backdrop-filter
- lint: Fail the build/lint when an invalid CSS rule is found
- webpack-loader crashes with inputSourceMap error when used after babel-loader
- core: shorthands.gridArea() does not expand custom idents properly HOT 7
- core: Support object literal with multiline keys HOT 2
- Can we cache the `makeStyles` internal HOT 2
- Failed to override styles when selectors are grouped
- lint: add lint rule which warn unused makeStyles classes HOT 2
- vite: add support for CSS extraction HOT 2
- core: add support for fallback properties in `makeStaticStyles` HOT 3
- lint: forbid comma separated selectors in selectors HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from griffel.