N
N
Ninja Mate2017-09-07 17:49:08
css
Ninja Mate, 2017-09-07 17:49:08

Why does the SASS compiler add a new class to the css instead of making changes, and how can I make it work without !important?

Added node-sass-chokidar to the project on create-react-app and bootstrap 4 sass
everything works, css is compiled.

"scripts": {
    "start-js": "react-scripts start",
    "start": "npm-run-all -p watch-css start-js",

    "build-css": "node-sass-chokidar --include-path ./src/styles --include-path ./node_modules src/styles/ -o src/styles/",
    "watch-css": "npm run build-css && node-sass-chokidar --include-path ./src/styles --include-path ./node_modules src/styles/ -o src/styles --watch --recursive",

    "build": "npm run build-css && react-scripts build"
  }

There is index.sass
// New color
$new-color: #6d314b;

.btn-primary {
  background-color: $new-color !important;
}

which, when compiled, turns into css and adds on top
.btn-primary {
  background-color: #6d314b; }

which only works if you add !important as the old class remains unchanged.
How to make changes instead of adding a class or making it work without important ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Sharomet, 2017-09-07
@sharomet

Move the class below the one that already exists. or create a new file and connect it last and make changes to it already.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question