Skip to content

Warning "Unrecognized at-rule or error parsing at-rule ‘@tailwind’." in clean install #190

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

Closed
febeling opened this issue Aug 12, 2022 · 3 comments

Comments

@febeling
Copy link
Contributor

febeling commented Aug 12, 2022

When starting a new rails 7 app and adding, then installing, tailwindcss-rails, and adding a single route using layout, the resulting page will produce this warning in the browser console:

Unrecognized at-rule or error parsing at-rule ‘@tailwind’.

The @tailwind at-rule should obviously not be in the processed output.

It still is, because the standard app/assets/stylesheets/application.css file contains the = require_tree . directive. This way, while the tailwind preprocessing does handle everything correctly, in addition the application.tailwind.css file is processed in the asset pipeline. It is concatenated into the fingerprinted application.css verbatim.

It does little damage, because all styles are working, but it's confusing and dirty. It might be obvious for many, but the docs for installation could use a note to change a possibly existing default application.css manifest.

Rails 7.0.3.1
tailwindcss-rails 2.0.12

@bdevel
Copy link

bdevel commented Dec 8, 2023

I've found this as well, which caused a lot of confusion. This behavior also prevents you from using require_tree . because you can't exclude the application.tailwind.css file.

For context:

The default app/assets/stylesheets/application.csshas:

/*
 *= require_tree .
 *= require_self
 */

Which includes app/assets/stylesheets/application.tailwind.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

On build, it just copies the application.tailwind.css verbatim into the published /assets/application-{CHECKSUM}.css file.

@flavorjones
Copy link
Member

I would welcome a PR with an update to the README's "Troubleshooting" section.

febeling added a commit to febeling/tailwindcss-rails that referenced this issue Jan 7, 2024
Add a paragraph to the Troubleshooting section about resolving a misconfiguration that otherwise causes double-processing of Tailwind's entry file, as described in issue rails#190.
@febeling
Copy link
Contributor Author

febeling commented Jan 7, 2024

@flavorjones You think this (#313) would do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants