I create my app with create-react-app and I try to use shared scss files. I have folder with them files common/styles/. And also I have some scss files there (_reset.scss, _variables.scss).
My _variables.scss:
$color-main: #1E700F;
My index.scss:
@import "variables";
Then I connect my index.scss and my index.js file
import React from 'react';
import ReactDOM from 'react-dom';
import './common/styles/index.scss';
import App from './App';
ReactDOM.render(<App />, document.getElementById('root'));
Then I create Button component in folder common/components/Button. And I want to use in my Button.scss next code:
.button {
border: 1px solid $color-main;
color: $color-main;
}
After I import my Button.scss to Button.js file I have next error:
SassError: Undefined variable: "$color-main".