-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
@apply can not be used (with postcss-import and webpack) #449
Comments
Can you publish a repository that reproduces this so I can clone it and troubleshoot? I'm guessing it's related to the critical CSS stuff; Tailwind can only |
I'm having the same problem. If I add
|
My repo is: https://github.com/tanc/particle-playground
Then run |
Here is mine: https://github.com/Tera3yte/tailwind-apply-error
|
@Tera3yte So in your case it's like I mentioned in my earlier comment, the Tailwind styles don't exist in your critical CSS tree so they can't be applied. I'd like to make it possible to apply Tailwind classes even if they don't exist eventually but right now it's not supported; it's going to be quite complex to implement. The way |
@tanc Not sure what's going on with yours, I can't get it to run locally and the errors I'm seeing are not Tailwind related:
I suspect it's a similar problem; the Tailwind classes don't actually exist in whatever CSS tree is being processed. Do you have multiple SCSS entry points in that project, or is it a single base SCSS file that imports everything else? |
Looks like you might have a port clash on 8080 But I think you're right there are multiple entry points, each component has an entry point and associated scss file. There is a base scss file which imports two of the tailwind includes but all the other project scss files are included with webpack through an index.js per component. So there is no way to include the tailwind utilities with each component and not have them duplicated in the final output? |
Not currently no, Tailwind can only |
No problem, thanks for the hard work on Tailwind, it looks very promising |
I found a workaround: add |
In case anyone stumble upon this issue… I had a similar issue where @apply wouldn't be parsed by tailwind. I was able to make it work by loading Tailwind plugin after postcss-import in my
Edit: This is actually perfectly well explained in the docs 😬 |
DO NOT write dot. Only the class name. // use
@apply css-class;
// instead of
@apply .css-class; |
I'm having the same issue and looks like it's caused by enabling However… without |
I used an other technique as an alternative using vuejs:
` usage: |
For me, It was a mistake putting my custom class name inside @apply {} section:
|
make sure you install 'postcss-import' then, in tailwind.config.js: |
This may be the better place (duplicate of tailwindlabs/webpack-starter#12)
I have this error:
And I do not know where this problem occures
My webpack.config:
Tailwind preflight is in assets/main/base/index.css (
@import 'tailwindcss/preflight';
)Tailwind utilities is in assets/main/utilities/index.css (
@import 'tailwindcss/utilities';
)And in assets/main/components/navigation/style-critical.css I have the
@apply
this stylesheet is imported in assets/main/components/components-critical.css (@import './navigation/style-critical.css';
)I think everything is configured as expected from tailwind
postcss.config.js
and package.json
If you need more information let me know. I do not know what I am doing wrong :(
The text was updated successfully, but these errors were encountered: