Is the hashing suffix necessary?
Yes
Would it still be unique as this?
Would be yes and would be no. depends
Why or why not?
Then let see on documentation
The query parameter modules enables the CSS Modules spec.
This enables local scoped CSS by default. (You can switch it off with
:global(...) or :global for selectors and/or rules.).
By default CSS exports all classnames into a global selector scope.
Styles can be locally scoped to avoid globally scoping styles.
The main purpose is here:
Styles can be locally scoped to avoid globally scoping styles.
You can do with this pattern '[path][name]__[local]'
, but you break the main purpose for scope.
If you have project frontend framework like angular
or reactjs
. for example angular
with directive
/component
or reactjs
with component
, this is the main purpose use scope css. With CSS modules, you can write normal CSS code and make sure, that it only applies to a given component. And we don't need overthinking name or long name for specific class name to avoid overwrite css