Topic: Custom SCSS (colors, typo, etc.)
paige free asked 6 years ago
Jakub Strebeyko staff answered 6 years ago
_custom.scss
(step 1.) and compiling it with npm run sass-compile
(step 2.) actually worked. I'm happy it helped!
With Best Regards,
Kuba
paige free commented 6 years ago
It partially worked! I can't overwrite any of the colors, but I can create new classes and use them without any problems. Still, changing the values of the colors which are already defined is not working! This solution will work for now, but we're hoping for a better solution in the future! Thanks, Kuba.Jakub Strebeyko staff commented 6 years ago
I totally get what you mean, feature request has been submitted. Cheers!paige free answered 6 years ago
Kuba,
Thanks for your well thought out response. Unfortunately, this did not work for me. I was hopeful that if I followed your instructions it would be enough to take care of my issues, but no matter how I tried to override the colors, it seemed to have no effect. My solution, for now, is to add classes to the _custom.scss file.
example:
.blue-btn { background-color: blue !important; }
when I run...
npm run sass-compile
, it successfully appends my new classes to the mdb.css file. I can use them as expected, and they don't seem to be conflicting with any of the other styles. This is working for now, but my team and I realize it's not an optimal solution. This is working for us now, but we're really hoping in the future we will just be able to override the variable names with ease. Hopefully, this will help someone else out who is having the same problem, or maybe someone who sees it will have a better solution that maybe I'm overlooking!
Jakub Strebeyko staff answered 6 years ago
Hi there Evan,
Thanks for reaching out and the kind words! When it comes to SCSS compilation you are right, it's not that straight forward, but that's the price for predictable rendering and ease of use. Anyway, if you have added mdbreact
as a dependency, installed them all and want to change some SCSS, just do the following:
- enter the
mdbreact
scss directory:cd node_modules/mdbreact/dist/scss
(depending on your operating system and currently viewed directory method of following the path may vary). Overwrite colors, classes etc. inscss/_custom.scss.
- in
node_modules/mdbreact
runyarn
/npm i
and thenyarn sass-compile
/npm run sass-compile
. It will enrichnode_modules/mdbreact/dist/css/mdb.css
with your custom styles! - make sure that up in your project directory you
import 'mdbreact/dist/css/mdb.css';
into yoursrc/index.js
file (part of step 5 in our Getting Started Guide, for the reference)
If the introduced changes are not temporary (and therefore you might want to keep them), we encourage saving the overwritten classes and properties separately, in case of an update. Let me know whether it helped!
With Best Regards,
Kuba
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB React
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No