-
-
Notifications
You must be signed in to change notification settings - Fork 383
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(loader): add functions support for locals #985
feat(loader): add functions support for locals #985
Conversation
|
db5d1be
to
db3ccf3
Compare
db3ccf3
to
d7f6ddb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add test case?
Wrote unit test. I don't know how to test the integration because I didn't find a css-loader that exports functions in open-source. Probably, we can mock it 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an integration test, because unit tests are useless in most of time and don't provide real examples
Can you provide an example of how can I mock css-loader output? Did not find similar tests in repo. |
why we need mock css-loader? Also you can create small custom loader to provide example of usage, we need just check work, no need to implement all features in loader, only for test |
Hello! Added tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just intresting - do you have a loader with such code generation?
Yes, I do. I have a fork of css-loader with the support of such code generation, the main idea is to parse BEM entities from classnames and generate ready-to-use functions with all possible mixes & modifiers. I'm currently working on getting this into open source. |
Codecov ReportBase: 90.34% // Head: 90.37% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #985 +/- ##
==========================================
+ Coverage 90.34% 90.37% +0.02%
==========================================
Files 5 5
Lines 829 831 +2
Branches 221 222 +1
==========================================
+ Hits 749 751 +2
Misses 70 70
Partials 10 10
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Thank you 👍 Sorry for delay |
Thank you too😊 |
This PR contains a:
Motivation / Use-Case
I came across an interesting case in which a custom (modified) css-loader exports functions (as named exports). The current implementation uses
JSON.stringify
, which causes export values of type function to becomeundefined
. This small improvement will make it possible to handle function exports.Breaking Changes
No braking changes.
Additional Info