Filip
Filip

Reputation: 945

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?

Upvotes: 0

Views: 915

Answers (2)

Sean Doherty
Sean Doherty

Reputation: 2378

Here is an article that discusses creating a custom css build and importing javascript on a per-component basis:

https://medium.com/@mattdlockyer/youre-using-materialize-css-wrong-470b593e78e9

enter image description here

Upvotes: 0

yeho
yeho

Reputation: 144

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

Upvotes: 1

Related Questions