Replies: 2 comments 1 reply
-
If you don't like the look of the You could also consider adding the Tailwind classes to the |
Beta Was this translation helpful? Give feedback.
0 replies
-
@wongjn that plugin approach worked like a charm. now we have |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We want to use Swiper in our Next.js application, but we want to customize the pagination.
We have two ways. The first way is to have global or module-level CSS files:
Yet because we're using Tailwind, having two different approaching for styling is not clean. So, we decided to use Tailwind to style it.
We use this code:
But as you can see, it's not readable. Look at that
[&_.swiper-pagination-bullet-active]
selector.So we decided to create a wrapper component for our Swiper needs and pass some parameters to it. This is our component usage:
While this approach is very clean and readable, it won't work because dynamically generating classes is not supported in Tailwind. In other words, we can't concat
bg-red-900
and[&_.swiper-pagination-bullet-active]
on the fly and expect it to work. The entire[&_.swiper-pagination-bullet-active]:bg-red-900
should be there in order to be picked up by Tailwind JIT compiler.Is there another way that we are not aware of for this purpose? Do we have any options in
tailwind.config.js
to allow the creation of this cleanSwiperWrapper
component?Beta Was this translation helpful? Give feedback.
All reactions