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

Can't use global .css when using modules with custom options #281

Closed
StarpTech opened this issue May 26, 2020 · 3 comments
Closed

Can't use global .css when using modules with custom options #281

StarpTech opened this issue May 26, 2020 · 3 comments

Comments

@StarpTech
Copy link

StarpTech commented May 26, 2020

When modules are activated with an object we can't use global CSS because everything is handled as modules.

postcss({
        modules: {
          generateScopedName: '[folder]__[local]',
          scopeBehaviour: 'local'
        },
        extract: true
      })

Input:

import './simple.css';

export default function Button() {
    return <div className={styles.button}></div>
}
.btn {
    color: red;
}

Output:

.Button__btn___yLF_B {
    color: red;
}

Workaround: Don't set custom modules settings.

Proposal:

Enable CSS Modules only on file convention or add a new option to infer the module mode by yourself.
https://github.com/egoist/rollup-plugin-postcss/blob/master/src/postcss-loader.js#L74

@NithinBiliya
Copy link

This is also impacting all the projects using microbundle. Noticed it in create-react-library.

@alanrubin
Copy link

Same here, want to mix module.scss with plain .scss (global), but unable to do it.

@egoist
Copy link
Owner

egoist commented Jul 14, 2020

fixed by #292

@egoist egoist closed this as completed Jul 14, 2020
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

4 participants