Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwind CSS doesn't get compiled in @import'ed files #230

Closed
Tracked by #240
SpadarShut opened this issue Aug 10, 2022 · 9 comments
Closed
Tracked by #240

Tailwind CSS doesn't get compiled in @import'ed files #230

SpadarShut opened this issue Aug 10, 2022 · 9 comments
Labels
bug Something isn't working needs-response We need a response from the original author about the issue

Comments

@SpadarShut
Copy link

Describe the bug

TailwindCSS doesn't get compiled if it's inside files that are imported.

In main css file:

@import "base.css";
@import "components.css";
@import "utils.css";

in imported files:

@tailwind base;

@layer base {
  #id {
    @apply flex min-h-screen flex-col;
  }
}

Reproduce

https://github.com/SpadarShut/jest-preview-import-tw-issue

Expected behavior

CSS should be compiled

Environment (please complete the following information)

  • OS: macOS 12.2.1
  • Browser: chrome
  • Jest version: 27.5.1
@SpadarShut SpadarShut added the bug Something isn't working label Aug 10, 2022
@nvh95
Copy link
Owner

nvh95 commented Aug 12, 2022

Hi @SpadarShut. Thank you for your report on this issue. I confirmed this is a bug from jest-preview. We will let you know when we release a fix for it.
For now, you can workaround by importing CSS files that have tailwind syntax directly to setupTests.js (setupFilesAfterEnv in jest.config.js)

// setupTests.js
import "base.css";
import "components.css";
import "utils.css";

@SpadarShut
Copy link
Author

Thanks! I worked around it in the same way.

@SpadarShut
Copy link
Author

While we are at it, can you tell if this is a bug or not: when i change values in a select, the preview does not reflect it, though elements dependent on that value are rendered correctly.

@nvh95
Copy link
Owner

nvh95 commented Aug 12, 2022

@SpadarShut I encountered this issue recently and I think this is related to @testing-library/dom interacting with jsdom. I am not sure if jest-preview could do anything to correct this behavior. I will let you know in the future if I have more insights/ ideas. For now, please think of it as a caveat. Thanks.

@SpadarShut
Copy link
Author

Thanks! I used testing library as well.

@nvh95 nvh95 mentioned this issue Aug 18, 2022
3 tasks
nvh95 added a commit that referenced this issue Aug 22, 2022
@nvh95 nvh95 mentioned this issue Aug 22, 2022
1 task
nvh95 added a commit that referenced this issue Aug 22, 2022
* feat: inline @import css

* test: add test for #230
@nvh95
Copy link
Owner

nvh95 commented Aug 22, 2022

Hey @SpadarShut. I fixed this issue and released version0.3.1-alpha.0. Please try it again and let me know if it resolves your problem.

I will include this fix in 0.3.1 in a couple of days.

image

@nvh95
Copy link
Owner

nvh95 commented Aug 22, 2022

@all-contributors please add @SpadarShut for bug

@allcontributors
Copy link
Contributor

@nvh95

I've put up a pull request to add @SpadarShut! 🎉

@nvh95 nvh95 added the needs-response We need a response from the original author about the issue label Aug 22, 2022
@github-actions
Copy link

github-actions bot commented Sep 2, 2022

This issue has been automatically closed because we haven't received a response from the original author 🙈. This automation helps keep the issue tracker clean from issues that are unactionable. Please reach out if you have more information for us! 💪

@github-actions github-actions bot closed this as completed Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-response We need a response from the original author about the issue
Projects
None yet
Development

No branches or pull requests

2 participants