themesberg / flowbite-react

Official React components built for Flowbite and Tailwind CSS
https://flowbite-react.com
MIT License
1.77k stars 395 forks source link

Flowbite setup with NX Monorepo #1355

Closed MuttakinHasib closed 2 months ago

MuttakinHasib commented 2 months ago

Hey @SutuSebastian

I am trying to setup Flowbite with NextJs on Nx Monorepo, but it's not working. Can you please take a look?

Here is the codesandbox link: nx-nextjs-flowbite

SutuSebastian commented 2 months ago

According to version 0.8.0 changelog and breaking changes, u have to do the following:

  1. correctly configure tailwind.config.js using the flowbite-react/tailwind proxy
Screenshot 2024-04-10 at 17 34 54
  1. flowbite package can be removed (optional)
Screenshot 2024-04-10 at 17 34 52

Refs: 0.8.0 Release changelog

MuttakinHasib commented 2 months ago

@SutuSebastian Do I need to pass the base to the plugin also?

flowbite.plugin({ base: '../../' })

SutuSebastian commented 2 months ago

@SutuSebastian Do I need to pass the base to the plugin also?

flowbite.plugin({ base: '../../' })

I gave u a functional example, since I cloned it myself for testing.

Reason of base option: node_modules folder is located two levels higher than where tailwind.config.js lives, hence the '../../'.

Note: base option is only for flowbite.content() function

MuttakinHasib commented 2 months ago

Need TS support here. it's not giving any suggestions.

btw, Thanks @SutuSebastian :heart:

SutuSebastian commented 2 months ago

Need TS support here. it's not giving any suggestions.

btw, Thanks @SutuSebastian ❤️

TS support/intellisense is only available within *.mjs or .ts(x) files, see below in a tailwind.config.mjs file:

Screenshot 2024-04-10 at 17 54 21 Screenshot 2024-04-10 at 17 54 35 Screenshot 2024-04-10 at 17 54 48
MuttakinHasib commented 2 months ago

@SutuSebastian Thanks :heart: