Performance and CDN

Topic: Performance and CDN

Nates pro asked 3 months ago


I am curious to know is it not better to load fontawesome and roboto font from CDN?

I can understand for development purposes, but is there documentation on using the CDN for these?

Am I missing something or not understanding why it is done in this current way?

import '@fortawesome/fontawesome-free/css/all.min.css'; import 'bootstrap-css-only/css/bootstrap.min.css'; import 'mdbreact/dist/css/mdb.css';

Anna Morawska staff answered 3 months ago

Hi there,

Yes, sure, it's not a problem, you can freely use cdn to load those stylesheets. We recommend importing these files from node_modules because we can adjust which version you are downloading, and make sure beforehand, that there are compatible.

Nates pro answered 3 months ago

okay so I did the following, please advise if it goes against anything that MDB does not recommend. I am using CRA.

Add the following to the index (head).html

<!-- FontAwesome 5.8.1 -->
  <script defer src=""

  <!-- Bootstrap CSS Only -->
  <link rel="stylesheet" href=""
    integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  1. Commented out these 2 lines

// import '@fortawesome/fontawesome-free/css/all.min.css'; // import 'bootstrap-css-only/css/bootstrap.min.css';

Also, is there no way to use Roboto fonts via CDN instead of via DIST copies ? What is the best way to do this without "upsetting" MDB installation?

Are there any negatives to this approach?

Anna Morawska staff answered 3 months ago

Yes, sure, if you want to customize our stylesheets, the best way is to switch to using scss, just install node-sass

yarn add -D node-sass

and follow the instructions provided here.

Then, to get rid of Roboto font, comment out or remove the scss import of typography module in the 'scss/mdb.scss'. You can also remove the entire font directory.

// @import "core/typography";

Please insert min. 20 characters.


Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: React
  • MDB Version: 4.11.1
  • Device: All
  • Browser: All
  • OS: Windows
  • Provided sample code: No
  • Provided link: No