Skip to content
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 removal of original class name #445

Merged

Conversation

joscha
Copy link
Contributor

@joscha joscha commented Mar 9, 2017

What kind of change does this PR introduce?
feature/performance

Did you add tests for your changes?
yes

If relevant, did you update the README?
yes

Summary

Does this PR introduce a breaking change?
No

@codecov
Copy link

codecov bot commented Mar 9, 2017

Codecov Report

Merging #445 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #445      +/-   ##
==========================================
+ Coverage    98.4%   98.41%   +<.01%     
==========================================
  Files           9        9              
  Lines         314      315       +1     
  Branches       71       72       +1     
==========================================
+ Hits          309      310       +1     
  Misses          5        5
Impacted Files Coverage Δ
lib/compile-exports.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6da7e90...8ce02a0. Read the comment docs.

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Just a few doc related nits. Thx very much for this PR :)

README.md Outdated
@@ -394,6 +394,15 @@ By default, the exported JSON keys mirror the class names. If you want to cameli
import { className } from 'file.css';
```

#### Possible options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- #### Possible Options 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, 9574dc0

README.md Outdated
@@ -394,6 +394,15 @@ By default, the exported JSON keys mirror the class names. If you want to cameli
import { className } from 'file.css';
```

#### Possible options

|Option|Behaviour|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the table directly under the camelCase header please

Behaviour => Description for consistency

Copy link
Contributor Author

@joscha joscha Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, 9574dc0 and 8ce02a0

package.json Outdated
@@ -1,12 +1,16 @@
{
"name": "css-loader",
"version": "0.26.2",
"version": "0.26.4",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done automatically. No need to change this file.

Copy link
Member

@michael-ciniawsky michael-ciniawsky Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ekulabuhov Good catch 💯 I totally missed it.

In a short while, if seen this a few times now, maybe we should update the PR_TEMPLATE to explicitly mention that npm version is always handled/done by us? cc @bebraw @d3viant0ne

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, open an issue at webpack-defaults so it gets sorted once and for all.

lib/loader.js Outdated
if(p.indexOf("../") !== 0)
p = "./" + p;
return "/" + p;
return source.split("!").pop();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related?

Copy link
Member

@ekulabuhov ekulabuhov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this PR needs a rebase.

@joshwiens
Copy link
Member

And please note, it need a rebase not a merge update or conflict resolution via github.

If you aren't comfortable with the rebase comment, give me write access to your fork and I can either do it or walk you through the process

@joscha joscha force-pushed the joscha/remove-original-class-name branch from 5679c8c to 9574dc0 Compare March 9, 2017 22:33
@joscha
Copy link
Contributor Author

joscha commented Mar 9, 2017

And please note, it need a rebase not a merge update or conflict resolution via github.

rebased onto master, please have another look @d3viant0ne @ekulabuhov

@ekulabuhov
Copy link
Member

👍 Great work!

Would it make more sense to opt in into generating original class names? Something like:
{ camelCase: 'withOriginal' }. I don't think many people depended or actually knew about this buggy behaviour. And in version 1.0 we're going to break it once again for people that switch to only or dashesOnly right now. Any opinions?

@joscha
Copy link
Contributor Author

joscha commented Mar 10, 2017

I don't think many people depended or actually knew about this buggy behaviour.

I know at least two companies that depend on this "feature" 💃 💃 💃 :)

@ekulabuhov I'd really like to get this fix into pre-1.0.0 and the only way to not break existing code is to make the feature opt-out instead of opt-in. I am happy to pick the PR to any 1.0.0 feature branch and make it opt-in to keep the original name, if there is one?

@joshwiens
Copy link
Member

@joscha - Yeah, this should go in before the next major. Backwards compatible and beneficial to both major versions.

@joscha
Copy link
Contributor Author

joscha commented Mar 10, 2017

@joscha - Yeah, this should go in before the next major. Backwards compatible and beneficial to both major versions.

@d3viant0ne agreed, so I think the current PR is gtg 🏃

@joshwiens
Copy link
Member

I'll merge this as soon as I finish up with a few other reviews.

@joshwiens joshwiens merged commit 3f78361 into webpack-contrib:master Mar 10, 2017
@joscha joscha deleted the joscha/remove-original-class-name branch March 10, 2017 05:33
@joscha
Copy link
Contributor Author

joscha commented Mar 10, 2017

I made a mistake on this - due to the change from #420 simple classes or ones that were already in camelCase are not exported any more because they are thought to be already on the object. This only happens when one of the new options is enabled. Will write a fix and send in a PR.

@joscha
Copy link
Contributor Author

joscha commented Mar 10, 2017

ever so sorry, the test cases were not wide enough and it wasn't picked up in the review - the fix is here: #448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants