Search code examples
cssreactjssassmaterialize

How to import and use materialize (or any other css library) sass in React


How should I correctly use materialize Sass in a react project created with create-react-app? Where should I keep the scss and js files?

I suppose if I use sass, I'm not supposed to be importing minified css and js files in my index.html?


Solution

  • 3 easy steps and you're set!

    1. install node-sass (npm install node-sass)
    2. if your materialize file is .css, change it to .scss
    3. import it! (import "./materialize.scss";)

    more info: https://scotch.io/tutorials/using-sass-in-create-react-app-v2