Comments (15)
@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.
from pbandj.
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.
from pbandj.
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!)
from pbandj.
@moishinetzer this is great! Thank you so much!
from pbandj.
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
from pbandj.
That's great project to integrate with 👍
from pbandj.
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
from pbandj.
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.
from pbandj.
from pbandj.
fyi to anyone following, i made this PR trying to add tailwind: #42
from pbandj.
@AlexMNet @AdonaiRdmeek did you guys get this working? Do you mind posting an example?
from pbandj.
Hi @Jared-Dahlke sorry I actually didn't end up working with this as I had some other pressing projects to attend to.
from pbandj.
@moishinetzer how do i implement this? I notice there is no .css file in /dist.
Should tailwind be installed in the consumer app?
from pbandj.
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.
from pbandj.
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
from pbandj.
Related Issues (9)
- Add users to all-contributors HOT 15
- CLI base project has type error HOT 1
- CLI doesn't work properly on Windows HOT 2
- Rebuilding on file changes HOT 3
- Question; can Vue and Angular be built as well? HOT 2
- yarn link support? HOT 1
- Update Node Version on Github Actions HOT 2
- [Documentation] Using other CI pipelines HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pbandj.