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

Support customizing scoped module in postcss-loader #119

Open
phthhieu opened this issue Aug 13, 2018 · 3 comments
Open

Support customizing scoped module in postcss-loader #119

phthhieu opened this issue Aug 13, 2018 · 3 comments

Comments

@phthhieu
Copy link

Currently, in postcss-loader https://github.com/egoist/rollup-plugin-postcss/blob/master/src/postcss-loader.js#L85, the plugin generate the scoped name as [name]_[local]__[hash:base64:5], could we support a feature to customize this?

@kendrickw
Copy link
Contributor

You can pass a custom scope name callback by specifying generateScopedName option in the modules option. See https://github.com/css-modules/postcss-modules for details of supported options.

For example:

postcss({
  modules: {
    generateScopedName: (cssname, filepath) => somelogic(cssname, filepath);
  }
})

@michaelCaleyWhaley
Copy link

@kendrickw Thanks for the reply. IMO would be super helpful to include an explicit example on the docs

@kaisershahid
Copy link

apparently this no longer works in 4.0.2. i am floored at how unbelievably difficult it is to override this basic option.

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