-
-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow modules.getLocalIdent
to return a falsy value
#963
feat: allow modules.getLocalIdent
to return a falsy value
#963
Conversation
Please accept CLA |
Also need update https://github.com/webpack-contrib/css-loader/blob/master/src/options.json#L41 and add test |
@evilebottnawi Thanks, signed the CLA. I think I'm missing something, I'm also not sure why some buils are failing. |
i was wrong, need update snapshots |
I already have updated the snapshots: |
@ziir update |
@evilebottnawi thnx, all checks are green now :) |
Thanks, release will be on next week (Monday i think) |
This PR contains a:
Motivation / Use-Case
With the suggested changes,
modules.getLocalIdent
would be allowed to return a falsy value, and in such case, the defaultgetLocalIdent
would be used instead.I am setting up a new project with
webpack
, I wish to apply the same chain of loaders on different kinds of.scss
files:main.scss
specified as anentry
in my configuration, meant to be used as global stylesheetApp.scss
SCSS modules which are imported from their matching component such asApp.js
This setup works very well for me, except that
main.scss
classnames necessarily go throughcss-loader
withmodules
enabled and usinglocalIdentName
.See the following example:
While browsing issues, looking for a way to not use
localIdentName
for mymain.scss
file, I stumbled upon #862.getLocalIdent: () => foo && 'bar'
seemed to be a great fit for my use-case.The behavior introduced in #865 wouldn't have worked for me though, here's what I did instinctively:
Note: my
main.scss
file resides inshared/assets/styles
.This way, my SCSS modules will use
localIdentName
andmain.scss
will uselocalName
.Breaking Changes
None
Additional Info
Thank you for this great package :)
I'm willing to make the final changes if this looks reasonable, thank you in advance for any response.