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

names in Module mode #70

Closed
haustraliaer opened this issue Jun 6, 2015 · 4 comments
Closed

names in Module mode #70

haustraliaer opened this issue Jun 6, 2015 · 4 comments

Comments

@haustraliaer
Copy link

The module mode local scope is amazing, but is there any way to name the classes other than picking up the file name of the import?

eg, given:

MyComponent /
   index.css
   index.js
/* index.css */
.root {
  /* styles */
}
// index.js
var styles = require('./index.css')

// react stuff etc..
return <div className={styles.root} />

will output to:

<div className="index__root__eofhi28o2"></div>

... And so will every other module I have (sans the hash appened) becase I like to keep my component folders named and my filenames generic.

So the desired result given the folder/files above would be:

<div className="MyComponent__root__eofhi28o2"></div>

Edited: for clarity

@haustraliaer
Copy link
Author

Found the place it seemed logical to do this and made a PR ^^

Feel free to suggest an alternative - my problem is specific to css-loader, so perhaps updatign the loader-utils module isn't necessarily the right thing? Although I'm sure this would be useful for other things too.

@joshwiens
Copy link
Member

@haustraliaer - It looks like you fixed your own issue? If that is the case and this is no longer a problem, could you please close the issue?

Thanks for the PR btw :)

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Mar 8, 2017

@haustraliaer if there should be any regressions please feel free to reopen, closing for now as it seems to be fixed 😛

@haustraliaer
Copy link
Author

Yep was sorted in webpack/loader-utils#27 - thanks, works a treat!

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

No branches or pull requests

3 participants