Closed AlexMNet closed 11 months ago
Hey Alex!
I'm still considering an extendable way to integrate Styling libraries (MUI, Tailwind etc.)
For now, use tsup's inbuilt postcss integration; you can read up about it on their documentation.
Follow this tailwind installation tutorial, which was made for vite but works perfectly fine for any PBandJ library.
Make sure to import the CSS file with the tailwind directives into your main index.ts
file, and for now, remove the css-check
script in package.json
(or even better, make it skip index.ts
)
After doing this, everything just works meaning you can publish your library, and users will have those styles shipped with it.
Note: those styles that tailwind generates will be shipped to the user, but it's unlikely they have their own
pb-3
class etc. So it should be completely fine to do so, in my opinion. But again, remember this caveat.
@moishinetzer this is great! Thank you so much!
Hey Alex!
I'm still considering an extendable way to integrate Styling libraries (MUI, Tailwind etc.)
For now, use tsup's inbuilt postcss integration; you can read up about it on their documentation.
Follow this tailwind installation tutorial, which was made for vite but works perfectly fine for any PBandJ library.
Make sure to import the CSS file with the tailwind directives into your main
index.ts
file, and for now, remove thecss-check
script inpackage.json
(or even better, make it skipindex.ts
)After doing this, everything just works meaning you can publish your library, and users will have those styles shipped with it.
Note: those styles that tailwind generates will be shipped to the user, but it's unlikely they have their own
pb-3
class etc. So it should be completely fine to do so, in my opinion. But again, remember this caveat.
Hello, I am wondering this, is there a way to integrate 2 different libraries, for example I myself want to use mantine and then tailwind, the tailwind part its simple, just wondering about mantine.dev
Mantine is even easier than tailwind! Check this quick example package I made. You can install it with
npm i compwithmantinee
It only exports a single component Button
, and it works totally fine in any project. Make sure to wrap all exported components in theMantineProvider
component
(P.S. If you publish your component library open an issue to be added to the main repo!)
That's great project to integrate with 👍
hey do you guys have an example repo with tailwind working? im trying to use this for a shadcn library but can't get the tailwind styles to apply
Hey Alex!
I'm still considering an extendable way to integrate Styling libraries (MUI, Tailwind etc.)
For now, use tsup's inbuilt postcss integration; you can read up about it on their documentation.
Follow this tailwind installation tutorial, which was made for vite but works perfectly fine for any PBandJ library.
Make sure to import the CSS file with the tailwind directives into your main
index.ts
file, and for now, remove thecss-check
script inpackage.json
(or even better, make it skipindex.ts
)After doing this, everything just works meaning you can publish your library, and users will have those styles shipped with it.
Note: those styles that tailwind generates will be shipped to the user, but it's unlikely they have their own
pb-3
class etc. So it should be completely fine to do so, in my opinion. But again, remember this caveat.
@Jared-Dahlke Have you tried going through these steps? I was thinking about porting this to integrate just with shadcn/ui which I might do soon. Try following these steps and it really should just work.
Yes tried it multiple times . What folder should I initiate tailwind in? An example would be amazing if it really is that easy
Sent from Proton Mail for iOS
On Wed, Sep 20, 2023 at 12:54 AM, Moishi Netzer @.***(mailto:On Wed, Sep 20, 2023 at 12:54 AM, Moishi Netzer < wrote:
Hey Alex!
I'm still considering an extendable way to integrate Styling libraries (MUI, Tailwind etc.)
For now, use tsup's inbuilt postcss integration; you can read up about it on their documentation.
Follow this tailwind installation tutorial, which was made for vite but works perfectly fine for any PBandJ library.
Make sure to import the CSS file with the tailwind directives into your main index.ts file, and for now, remove the css-check script in package.json (or even better, make it skip index.ts)
After doing this, everything just works meaning you can publish your library, and users will have those styles shipped with it.
Note: those styles that tailwind generates will be shipped to the user, but it's unlikely they have their own pb-3 class etc. So it should be completely fine to do so, in my opinion. But again, remember this caveat.
@.***(https://github.com/Jared-Dahlke) Have you tried going through these steps? I was thinking about porting this to integrate just with shadcn/ui which I might do soon. Try following these steps and it really should just work.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
fyi to anyone following, i made this PR trying to add tailwind: https://github.com/moishinetzer/PBandJ/pull/42
@AlexMNet @AdonaiRdmeek did you guys get this working? Do you mind posting an example?
Hi @Jared-Dahlke sorry I actually didn't end up working with this as I had some other pressing projects to attend to.
@Jared-Dahlke here is an example of implementing tailwindcss. Look at the diff between the init commit and the latest commit to see how I implemented it:
https://github.com/moishinetzer/pbandj-withtailwind
I've been thinking a bit and I think the future is this:
Bundling with bun, by default loading all shadcn/ui components.
But, that would be a completely different project, so I will have a separate repo for this. I think this is interesting to most people, so upvote this comment if you would like to see something like this in the future.
@moishinetzer how do i implement this? I notice there is no .css file in /dist.
Should tailwind be installed in the consumer app?
Well that's the beauty it's all injected when the package is imported. Please read through all the docs all of this is expanded there.
this works flawlessly. thank you!!!
I just added shadcn it was pretty easy as expected. I think the tricky part was just getting tailwind to work properly. But yes, i just spent weeks trying to get to this point. There are a handful of other shadcn starter npm libraries out there but none of theme do all of the following:
work with nextjs (app and pages) and vite tree shaking consumer app doesn't have to have tailwind installed types flow through
Hi Moishi, First off great job with this package! I'm really interested in integrating tailwindcss. How can we go about that?