feat: allow modules.getLocalIdent to return a falsy value#963
Merged
alexander-akait merged 2 commits intowebpack:masterfrom Jun 28, 2019
Merged
Conversation
Member
|
Please accept CLA |
Member
|
Also need update https://github.com/webpack-contrib/css-loader/blob/master/src/options.json#L41 and add test |
Contributor
Author
|
@evilebottnawi Thanks, signed the CLA. I think I'm missing something, I'm also not sure why some buils are failing. |
Member
|
i was wrong, need update snapshots |
Contributor
Author
|
I already have updated the snapshots: |
Member
|
@ziir update |
Contributor
Author
|
@evilebottnawi thnx, all checks are green now :) |
alexander-akait
approved these changes
Jun 28, 2019
Member
|
Thanks, release will be on next week (Monday i think) |
This was referenced Mar 21, 2020
This was referenced Sep 22, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains a:
Motivation / Use-Case
With the suggested changes,
modules.getLocalIdentwould be allowed to return a falsy value, and in such case, the defaultgetLocalIdentwould 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.scssfiles:main.scssspecified as anentryin my configuration, meant to be used as global stylesheetApp.scssSCSS modules which are imported from their matching component such asApp.jsThis setup works very well for me, except that
main.scssclassnames necessarily go throughcss-loaderwithmodulesenabled and usinglocalIdentName.See the following example:
While browsing issues, looking for a way to not use
localIdentNamefor mymain.scssfile, 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.scssfile resides inshared/assets/styles.This way, my SCSS modules will use
localIdentNameandmain.scsswill 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.