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

Added isomorphic CSS modules #48

Merged
merged 2 commits into from
Jul 25, 2015
Merged

Added isomorphic CSS modules #48

merged 2 commits into from
Jul 25, 2015

Conversation

ashtonsix
Copy link

Works by searching webpacks internal module memory and extracting the relevant JSON from source. Additional info is saved to webpack-stats.json where it can be read from both the server and client.

@erikras
Copy link
Owner

erikras commented Jul 25, 2015

This is brilliant! Thanks! 👍

erikras added a commit that referenced this pull request Jul 25, 2015
Added isomorphic CSS modules
@erikras erikras merged commit c2ab42c into erikras:master Jul 25, 2015
@erikras
Copy link
Owner

erikras commented Jul 26, 2015

You clearly have a better understanding of how webpack works than I do. Perhaps you could make some headway on #39?

@ashtonsix
Copy link
Author

I'll give it a look sometime this week.

@codepunkt
Copy link
Contributor

Is it just me or did this commit break style sourcemaps? :-/

@erikras
Copy link
Owner

erikras commented Jul 26, 2015

Yes, I think it did. @ashtonwar !! 😄

@ashtonsix
Copy link
Author

Yup.. sorry I'm too busy to look into this immediately.

My guesses for possible causes:

  • css modules does not support sourcemaps
  • upgrading ExtractTextPlugin
  • importLoaders option on css-loader

Based on this query my money is on this bieng an issue with css-loader.

@leonli
Copy link
Contributor

leonli commented Jul 28, 2015

Hi @erikras I think this library has found a way to resolve the problem on #39

https://github.com/iam4x/isomorphic-flux-boilerplate/blob/master/app/utils/image-resolver.js

import imageResolver from 'utils/image-resolver'

let image;
// On browser just require() the image as usual
if (process.env.BROWSER) {
  image = require('images/logo.png');
}
else {
  image = imageResolver('images/logo.png');
}

...
render () {
  return (
    <img src={image} />
  );
}
...

@codepunkt
Copy link
Contributor

@leonli thats nice, why don't you add that comment to #39 instead of adding it here?

@erikras erikras mentioned this pull request Jul 28, 2015
@erikras
Copy link
Owner

erikras commented Jul 28, 2015

I copied it.

@leonli
Copy link
Contributor

leonli commented Jul 28, 2015

Thanks @erikras

@ashtonsix
Copy link
Author

@erikras Doing return stats.css.modules[require.resolve('views/styles/App.scss')]; works better than using path & utils

@erikras
Copy link
Owner

erikras commented Jul 31, 2015

@ashtonwar Nice.

@codepunkt codepunkt mentioned this pull request Jul 31, 2015
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

Successfully merging this pull request may close these issues.

4 participants