简体   繁体   中英

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?

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

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM