Replies: 3 comments 3 replies
-
I expect this is a CRA problem, do you have This works as expected with postcss-cli for example, so I don't think this is an issue in Tailwind itself. Personal recommendation is to avoid CRA if you can, Vite for example can do everything CRA can do and is much faster and supports custom PostCSS configurations which CRA doesn't. |
Beta Was this translation helpful? Give feedback.
-
so i found something in our app that could potentially help some of you with these import order issues. even though our what i found was that in our
/* index.tsx */
import { App } from 'src/App';
import './i18n';
import './index.css'; // this file holds all tailwind styles
// ... /* index.css */
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities'; the component tree ( i moved the import of /* index.tsx */
import './index.css'; // this file holds all tailwind styles
import { App } from 'src/App';
import './i18n';
// ... |
Beta Was this translation helpful? Give feedback.
-
This is code from tailwind: [type=button],
[type=reset],
[type=submit],
button {
-webkit-appearance:button;
background-color:transparent;
background-image:none
} In our case, the The following fixed it: - button {
+ button[type=button] {
@apply outline-none m-1 p-1 rounded;
@apply text-center text-sm font-normal;
@apply text-black bg-indigo-200;
} But in the tailwind code, shouldn't those be changed to the following? - [type=button],
- [type=reset],
- [type=submit],
+ button[type=button],
+ button[type=reset],
+ button[type=submit],
button {
-webkit-appearance:button;
background-color:transparent;
background-image:none
} |
Beta Was this translation helpful? Give feedback.
-
What version of Tailwind CSS are you using?
v3.0.16
What build tool (or framework if it abstracts the build tool) are you using?
postcss 8.4.5, react-scripts 5.0.0
What version of Node.js are you using?
v14.7.0
Describe your issue
#7049 describes my issue very well as it's the exact same one. I'll copy down below:
I am adding some style classes after tailwind/base and tailwind/components via an import that for some reason gets overridden
when I inline the styles from button.css, the styles work perfectly, and overwrite the tailwind styles, due to css order. (both selectors have a specificity of 010)
once I move them to the imported file, the custom styles seem to be loaded before the tailwind styles, and break.
i can reproduce the issue with a brand new CRA5:
yarn create react-app my-app --template=typescript
apply these changes:
the applied styles in the devtools look like this:
![149301711-90d6215c-f69e-4589-8a55-66c0239d4ba3](https://user-images.githubusercontent.com/59735181/152122717-0879464f-84eb-437c-88d7-e85ea9744d3d.png)
you see that this definition overwrites our button styles, even though they should be loaded before our button styles.
Beta Was this translation helpful? Give feedback.
All reactions