-
Notifications
You must be signed in to change notification settings - Fork 1.9k
postcss-import #1472
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
Comments
Hey! Can you create a simple project that shows something being broken? That would make it much easier to get on the same page about what we're talking about here.
Neither of these are true in my testing, here's a working demo where you can see you don't need to duplicate |
This is a repo replicating the issue. Followed these two guides |
Ah ok so the problem is you are using Create React App and it doesn't support Unfortunately nothing we can do here, there's an open PR on the CRA repo but I don't expect it to be merged: facebook/create-react-app#11926 I would recommend just not using CRA if you can avoid it — it's quite configuration-hostile and not really actively maintained. Going to close this since this is a CRA problem and we can't do anything about it on our end. |
@adamwathan Or perhaps there is a much better alternative you could recommend in that article instead. And the article can be replaced. Seems like it might be a good change. Ps: thanks for the help and for checking this out. |
@seanpanda0 Yeah that's why we have this big warning at the top of the guide: I think we can probably make it more in your face and scary though, will see what I can come up with. |
Awesome! |
Context
In this article about postcss-import.
using-with-preprocessors#build-time-imports
There is an issue with implementing that as described.
Basically
@layer and @tailwind
(from tailwind) dont play nicely with@import
(from postcss-import).Problems with the article
One you cant use
@layer base
in a imported file without also declaring@tailwind base
in the same file. duplicating the@tailwind base
declaration also duplicates tailwinds base css declarations. (some rule applies to the@import 'tailwindcss/base'
).You get errors like this
Syntax error: /typography.css "@layer base" is used but no matching "@tailwind base" directive is present.
Two declaring
@import 'tailwindcss/base'
before@import './custom-base.css'
does not actually place the css declarations in the right order. the@tailwind
declarations seem to be processed after the@imports
no mater what order you place them in. the result is tailwindcss/base overrides the custom-base.css despite the order.Working Solution and postcss-import layer system.
Basically you can use postcss-import layers instead of tailwinds layers and then things are placed in the expected order and you can use
@layer
inside of imported files.I would like the postcss-import layer system to be mentioned in that article.
I'd make a PR for the documentation if I was sure where I should put it.
This works a lot better if you're going to be importing css files.
Versions
References
Unfortunately I didn't find additional documentation for postcss-import layers.
However you can find examples in under their tests fixtures,
anything with layer in the filename should be helpful.
The text was updated successfully, but these errors were encountered: