Replies: 6 comments 7 replies
-
As per the documentation, Tailwind is not meant to be used with Sass:
You do seem to have a typo as well - you have -@thema {
+@theme {
--color-chocolate: #7B3F00;
} |
Beta Was this translation helpful? Give feedback.
-
Tailwind v4 can be used with Sass but you have to tip-toe around both systems. If I remember right, the Vite Tailwind plugin didn't work (and also didn't allow me to point to other node_module directory [I'm using a monorepo]), so I had to use the Postcss Tailwind variant. postcss.config.cjs ...
plugins: {
'@tailwindcss/postcss': {
base: join(__dirname, '../../'), // Optional - if Tailwind is installed in another folder's node_module
},
... whatever.scss @include meta.load-css('tailwindcss');
@theme {
--color-whatever: red;
} Tips:
$tw-border-color-syntax: string.unquote('--value(--border-color-*)');
@utility border-* {
border-color: $tw-border-color-syntax;
}
@import '../../node_modules/tw-animate-css/dist/tw-animate.css';
@source '../../../tokens/dist/web/colors.js'; I wish Tailwind v4 supported preprocessors still. I tried converting over to plain css and PostCSS, but PostCSS ecosystem to do looping/variables/conditionals feels a bit fragmented and unmaintained. I understand that native css replaced a lot of things that preprocessors used to handle, but there are some things Tailwind doesn't have an alternative for like looping and conditions and using PostCSS to do that doesn't feel great. |
Beta Was this translation helpful? Give feedback.
-
Remix version 6 have spent a day trying all kinds of fixes ... using the default vite module with that Remix 6 , trashing build and cache folders every time as I npm run dev Created all the recommended postcss and tailwind.config.js files. checked package.json. Re ran installs. But cannot resolve even with Copilot GPT-4.1 weighing in. These are installed in node_modules. Copilot is scratching its AI head as all known "fixes" fail to get my app up and running. |
Beta Was this translation helpful? Give feedback.
-
@kerryj89 thank you! it worked! I had to add @use "sass:meta"; before loading tailwind, but it has finally worked 🙌 thanks for your help!
|
Beta Was this translation helpful? Give feedback.
-
@kerryj89 curious if you also had the problem with tailwind messing up the existing scss styling. in my project we're importing css styling from another library, the moment I plug in tailwind through .postcssrc.cjs, it makes the pagination no longer sticky, one page doesn't show up completely etc. here's what I tried in app.scss
|
Beta Was this translation helpful? Give feedback.
-
@kerryj89 thanks for your response, I'm new to layers. Here's the setup, I made some adjustments
@MyLib doesn't use layers. whether I have @MyLib as reset, it doesn't really make any difference - the moment I have tailwind enabled, the pagination no longer acts as sticky and the user needs to scroll to see it. without tailwind - the pagination acts sticky at the bottom of the screen and the content of a table is scrollable. or another issue, when tailwind is on, our menu doesn't show styled , but when it's off, the lines appear not sure what else to try. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to add tailwind to the project to slowly migrate away from scss.
I have app.scss and App.tsx, followed the documentation, but nothing seems to work to import tailwind.
Tried so far:
in app.scss
@import url('tailwindcss/index.css'); <-- nothing
vite.config.ts has the tailwindcss(),
The only way I can use tailwind classes is by importing
import 'tailwindcss/index.css';
in App.tsx.The only problem is that custom styling then doesn't work, I've tried creating tailwind.css with
@theme { --color-chocolate: #7B3F00 }
and importing it in app.scss
@import './tailwind.css';
but the bg didn't work at all, when pt-2 did work.
I've run out of ideas how to make it work.
Beta Was this translation helpful? Give feedback.
All reactions