create-react-app
create-react-app copied to clipboard
scss @import directive doesn't work
I am triying yo use @import directive but it does't work with: "react-scripts": "2.1.8"
I follow this steps: https://facebook.github.io/create-react-app/docs/adding-a-sass-stylesheet
I have two files: App.scss and _vars.scss both into the src folder. When I import _vars.scss into App.scss I get this error:
Failed to compile.
./src/App.scss (./node_modules/css-loader??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/lib/loader.js??ref--6-oneOf-5-3!./src/App.scss)
.App {
^
Media query expression must begin with '('
in /Users/farv/repos/pr-components/src/App.scss (line 3, column 1)
// App.scss
@import 'var.scss'
.App {
text-align: center;
}
....
//_vars.scss
$colorRed: 'red'
Was my foult because I forget to add ";" at the end of the @import line. This is working fine:
// App.scss
@import 'var.scss';
.App {
text-align: center;
}
....
//_vars.scss
$colorRed: red