// step 1: install node-sass
// using npm
npm install node-sass --save
// using yarn
yarn add node-sass
// step 2: Convert your .css files to .scss
// step 3: add in your app.js
import './App.scss';
$ npm install node-sass --save
$ # or
$ yarn add node-sass
npm install node-sass --save-dev
npm i sass
npm i node-sass@4.14.1
yarn add node-sass@4.14.1
# using npm
npm install node-sass --save
# using yarn
yarn add node-sass
Note: LibSass and the packages built on top of it, including Node Sass, are deprecated. If you're a user of Node Sass, you can migrate to Dart Sass by replacing node-sass in your package.json file with sass or by running the following commands:
$ npm uninstall node-sass
$ npm install sass
# or
$ yarn remove node-sass
$ yarn add sass
$ npm install node-sass --save$ # or$ yarn add node-sassCopy
npm uninstall node-sass
npm install node-sass
change the "react-scripts": "4.0.0" into "react-scripts": "4.0.3" in package.json and save
npm install
npm start
or, using yarn -
yarn remove node-sass
yarn add --dev node-sass
as above
yarn install
yarn start
npm install sass --save-dev
import './App.css' turns into import './App.scss'
$myColor: red;
h1 {
color: $myColor;
}
npm uninstall node-sass
//index.js:
import React from 'react';
import ReactDOM from 'react-dom/client';
import './my-sass.scss';
const Header = () => {
return (
<>
<h1>Hello Style!</h1>
<p>Add a little style!.</p>
</>
);
}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Header />);