rollup-plugin-postcss icon indicating copy to clipboard operation
rollup-plugin-postcss copied to clipboard

Support customizing scoped module in postcss-loader

Open phthhieu opened this issue 7 years ago • 3 comments

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?

phthhieu avatar Aug 13 '18 01:08 phthhieu

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);
  }
})

kendrickw avatar Dec 19 '18 17:12 kendrickw

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

michaelCaleyWhaley avatar Apr 14 '21 11:04 michaelCaleyWhaley

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

kaisershahid avatar May 24 '22 23:05 kaisershahid