Replies: 6 comments
-
How do you guarantee uniqueness throughout your whole application? Our support should already be emitting class names like this, plus a hash ( |
Beta Was this translation helpful? Give feedback.
-
In our case the file name is always The component name (or rather its path) guarantees uniqueness. Another example of our former identifiers: |
Beta Was this translation helpful? Give feedback.
-
tl;dr: To set expectations, we're probably not going to ship with this ability by default. Read on for testing alternatives. Customizing the emitted CSS identifiers is a footgun, as uniqueness is no longer guaranteed and we may optimize them in the future. For example, we may explore these optimizations:
Our new CSS support is extremely focused on correctness — allowing this option may undermine that correctness and our flexibility to innovate in the future. We can reconsider this when it's released stable if there's significant demand. IMO, there's better options here:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply. I think your reasoning and strategy makes total sense. Also less configuration for the user. I guess we'll have to use Cheers 🙂 |
Beta Was this translation helpful? Give feedback.
-
Your use case would probably be served well by |
Beta Was this translation helpful? Give feedback.
-
@Timer when you say not ship with the ability to do this, are you referring to what has been requested in this issue, or the ability to turn on the experimental CSS features (which would Customize the CSS identifiers)? I'm using BEM and next-css and well... this is a big change, I'm using a well documented system for creating components (BEM), and I'm concerned that the new CSS features are going to mean that we'll end up having to re-invent the wheel by creating something that works with a CSS module based approach. I could maybe do this: |
Beta Was this translation helpful? Give feedback.
-
Feature request
Problem
Our Selenium tests rely on a specific naming of class names in the HTML. E.g.
class="Header__link"
, whereHeader
is the name of a component, andlink
is a class in the component's CSS module).With the current experimental CSS support in Next.js, there's no apparent way to customize the outputted CSS identifiers.
With
next-css
, we used to simply override the Webpack config with our own css-loader optionslocalIdentName
andgetLocalIdent
).Proposed solution
Please allow to override the Webpack config like it was the case with
next-css
.Thanks!
Related to #8626.
Beta Was this translation helpful? Give feedback.
All reactions