I created a Rails 7 app using rails new demo -j esbuild --css tailwind
.
I am using antd
package for the components and want to use the ant design stylesheet along with the tailwind stylesheet.
Tailwind has a way to add external stylesheets to its default styles. I used that and set application.tailwind.css
file to this:
@import "~antd/dist/antd.css";
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
Now when I run ./bin/dev
, the antd
styles are neither applied nor those style classes are present in the generated app/assets/builds/application.css
file.
It looks like tailwind overwrites the ant design styles.
If I keep application.tailwind.css
and add
import 'antd/dist/antd.css';
to my index.js
root file, only then are the antd
styles being applied and are present in the generated app/assets/builds/application.css
. But then the tailwindcss classes are removed.
How can I have both ant design styles and tailwind styles together in the generated app/assets/builds/application.css
?