I'm working in a project where we are using React, we are writing our styles with SASS and then let webpack do the rest.
We just recently started using CSS Modules (babel-plugin-react-css-modules to be exact) and the transition has been smooth, except for one thing.
Before the CSS Modules, we were utilising the BEM naming convention. It would often happen that we would do something like this, inside a component's .scss file:
$block: '.box';
#{$block} {
//css rules
&#{$block}--modifier {
//other rules
}
}
In essence we were making use of SASS's variable interpolation capability, in order to write less in the case where the block level element's class name was big.
The problem is that as far as I can tell variable interpolation, for such a scenario, is no longer working with babel-plugin-react-css-modules.
I am getting an error like
ERROR in ./src/index.jsx
Module build failed: Error: E:/Mitch/Workspace/Projects/testbed/src/index.jsx: Could not resolve the styleName 'box'.
I understand that with scoped CSS rules, there is really no need for writing something like .box__list anymore, since you can simply write .list, since it's scoped to the component, but just for curiosity's sake, is it possible to have SASS's variable interpolation work with babel-plugin-react-css-modules ?