Skip to content

Cannot both control generateScopedName and use posstcss plugins. #37

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

Closed
pekim opened this issue Sep 27, 2015 · 3 comments
Closed

Cannot both control generateScopedName and use posstcss plugins. #37

pekim opened this issue Sep 27, 2015 · 3 comments

Comments

@pekim
Copy link

pekim commented Sep 27, 2015

The return in https://github.com/css-modules/css-modules-require-hook/blob/master/src/index.js#L58 means that the generateScopedName option is ignored when postcss plugins are configured (with use).

It looks like #34 was intended to address this, but as far as I can tell it doesn't. The return statement continues to be a problem.

Replacing

  if (customPlugins) {
    return void (plugins = customPlugins);
  }

  plugins = [];

with

  if (customPlugins) {
    plugins = customPlugins;
  } else {
    plugins = [];
  }

(or at least hacking in the equivalent in dist) works for me. I'm not sure if it would break any other use cases.

I have a feeling that I may be simply overlooking or misunderstanding something.

@mightyaleksey
Copy link
Member

Hi, can you show your set up or at least describe how you want to use it?

generateScopedName function usually passed to the scope plugin. That's why it will not work if you specify the custom list of plugins with use.

@pekim
Copy link
Author

pekim commented Sep 28, 2015

There was nothing in the scope plugin's documentation about how to configure the {{generateScopedName}}, so I didn't go that route.

Now that I've looked at the plugin's source, I see that it is simply an option that can be passed. So I'll do that.

I shouldn't have been quite so lazy in the first place. Sorry for the noise.

@pekim pekim closed this as completed Sep 28, 2015
@mightyaleksey
Copy link
Member

It's ok, I guess I'd better update the readme file :)

Thank you for your concern

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

2 participants