Topic: Mdbreact css and Next.js

bgining2this free asked 5 years ago


When i add all the required css by mdbreact, next.js complains, is there a way to do this with a cdn ?

I get css import errors

When importing all this.-

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

import 'bootstrap-css-only/css/bootstrap.min.css';

import 'mdbreact/dist/css/mdb.css';

So maybe a cdn link could be the solution so i can add that in the _document.js ? Or http link ?


Jakub Chmura staff answered 4 years ago


@lvothnrv,

I already fix an issue with CSS import and icons what you can see at my GitHub repo :

https://github.com/JakubChm/nextjs-mdbreact

If you can't use my repo as a template, please change in your _app.js file as in the example below:

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

Then remove from package.json a @zeit/next-css dependency. After that please remove your package-lock.json / yarn.lock file and node_modules folder and then type in your terminal yarn/npm i command. After these steps, everything should be fine.

Best, Kuba


lvothnrv free commented 4 years ago

Hi,Thank you very much my friend !


Jakub Chmura staff commented 4 years ago

Your welcome, if you ever need help, don't hesitate to ask me.

Best, Kuba


lvothnrv free answered 4 years ago


Hi,

Hello, I would need some help if you don't mind .. infact I'm trying to put mdbreact on my nextjs project and it tells me this .. I'm on the latest version of Next React Mdbreact ..

enter image description here enter image description here


Jakub Chmura staff commented 4 years ago

Hi @lvothnrv,

Thank you for the founded issue. I will try to check what's going on as soon as possible.

Best, Kuba


Jakub Mandra staff answered 5 years ago


Hi,

Check my article about how to integrate mdbreact with Next.js :)

Link: https://mdbootstrap.com/articles/react/materialize-your-next-js-project-with-mdbootstrap-for-react/

Best,

Jakub


bgining2this free commented 5 years ago

Thank you Jakub !!

That is great ! Just what i was looking for. Have a great day.


Two Aow priority commented 2 years ago

this link no longer works. Is it available and updated elsewhere?



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.11.0
  • Device: Desktop
  • Browser: Google Chrome
  • OS: Linux
  • Provided sample code: No
  • Provided link: No