-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
CSS Module composes with different file #184
Comments
@erikras Now that I think about it, this issue is not really about this example project. I can create new issue at webpack-isomorphic-tools repo if you want. |
Ok, I get it, the name I gave that file - As for the bug, @jepezi, can you tell me, where does the error occur according to your stacktrace? |
@jepezi I've run into the same issue catamphetamine/webpack-isomorphic-tools#1 For now, I'm working around it by changing the |
My thought is that it's not an issue in anyone's logic. |
@halt-hammerzeit @bdefore Yeah I think you're right. Just tried // exports part |
That would be great. |
so I made a small change to
Take the JSON part
And replace all such things:
with something like required = find ./text-underline.css from options.webpack_stats.modules
required = required.source
replaced = take the css loaders array from webpack.config.js and transform it to a string prepending "./../../../node_modules/"
replace(replaced with required) |
Still, the possible way I suggested is a very hacky one and I don't think anyone would go that way. |
thanks for doing that nikolay... I'll explore this further shortly. I have On Monday, September 14, 2015, Nikolay notifications@github.com wrote:
|
I'm still getting this error. What's the solution? |
Also found this: css-modules/css-modules#13 |
@fingermark i'd love to hear if you've solved this. @halt-hammerzeit i explored your situation but in the end felt stuck on how i'd get a proper class name out of the step you describe:
Is the objective to end up with a mapping to something like |
@bdefore the objective is to end up with whatever you are aiming for. I guess what you are aiming for is a JSON object which maps something to something. |
@bdefore I have not. I gave up on a universal app for the time being. I was able to compose just fine with react-starter-kit, though, but had issues with changes permanently going into effect with BrowserSync. I'm using my own starter-kit now w/o universal support and everything is working just fine. |
Hi it's been a while. What I end up doing was to completely change the way to set up webpack config and run it on server code as well, then all require calls on server are "webpacked". |
@jepezi not sure i understand. could you provide that config? |
Hi, so I've hacked together a solution based on what halt-hammerzeit mentioned above. I'm completely new to React and Webpack and I've made a couple of assumptions about how things work so this may not be a 100% solution but it seems to work in my limited testing. I've hacked it together quickly and it's late for me so please forgive me if it's a bit messy and not so elegant... I had an issue with the paths in the require call being different to what was available in the webpack_stats.modules. e.g. This lead to a second problem where that actually matches multiple modules in the webpack_stats.modules. So I'm taking the first one because that seems to be the one with the correct source. Big assumption here... @bdefore this is my new parser config in
|
@shark404 oh, so you actually made it. As for the relative
|
(i've updated my post above: my previous code was irrelevant and this seems to me a significantly more complex task than I've estimated in the beginning) |
@halt-hammerzeit I just really like the idea of modular css as it allows me to do something like In
Then in a specific component I may want to override something from the .btnPrimary.
Then in my React component I can just require Maybe I'm just not doing things in a "React" way and there is a better way to approach this? If anyone has any insights I'd love to hear. |
@shark404 oh, I see. That's a handy feature. |
@halt-hammerzeit the issue with sass Mixins and Inheritance combined with Webpack is that the end result is a lot of duplicated css. Maybe I'm missing something but I believe it works l like this:
When I
Now if I have a second component that needs
The class name hashes will be different because that's how it's supposed to work. Everything is supposed to be local to the Maybe having the duplicated css isn't much of an issue and I'm just being stubborn, but css modules seem like the most elegant way to achieve this. As I mentioned I'm completely new to React and Webpack so maybe there is a better solution to what I'm trying to achieve, or maybe I should be thinking in the React way and I shouldn't be trying to share css like that? For the moment, my |
@shark404 you are right, the CSS is duplicated in the case of mixins. you're right that in the programming world there's no absolute solution and one should use what's good enough. |
@shark404 thanks for posting that. i'll have a go at integrating your parser function and follow up in the next few days. |
Yo, everybody. |
In the meantime, while my PR is pending, I've just released v2.1.0 of
|
The PR has been merged. (in 2.2.0 |
Any feedback on if the new isomorphic tools resolves this issue? |
@quicksnap Well, how is my message, which is an inch higher than yours, not a feedback? |
@quicksnap I've updated and after limited testing it seems to be working fine. Thanks @halt-hammerzeit ! 😄 |
Hi,
Have you guys use
composes
feature of CSS Module? I have this error when I try to compose css class from different file.Here's what I've tried.
About.js
, add this require to the top of render() and add className toAbout.scss
About.scss
This will give error from webpack-isomorphic-tools. I guess it has something to do with how composes work and the parser function.
Any idea how to fix this?
@halt-hammerzeit @erikras
The text was updated successfully, but these errors were encountered: