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 not being created on the first run when the directory doesn't exist #158

Closed
pupeno opened this issue Mar 24, 2022 · 5 comments

Comments

@pupeno
Copy link

pupeno commented Mar 24, 2022

I'm not sure if this the right place to report this bug, I'm not even sure if this is a bug.

I have a Rails 7 project created recently with the --css=tailwind option. At some point apparently I deleted app/assets/builds/.keep which caused the directory app/assets/builds to just not be created git clone. The odd result was this: when deploying to heroku, when heroku would run rake asset:precompile, it would silently not create the tailwind.css file. But if I open a shell and run it again, it would create it.

I posted on Stack Overflow, so there are more details there: https://stackoverflow.com/questions/71538223/tailwind-css-not-being-generated-in-a-rails-7-project-in-heroku/71607506

I'm sorry about the low quality of this bug report, I don't understand all the moving pieces, just the symptoms. Maybe this will be obvious to someone that understand things a bit better. If there's a way for me to provide more and better info, please ask and I'll do my best.

@reefdog
Copy link

reefdog commented Mar 29, 2022

Perhaps my similar experience will help triangulate the issue: I just came aboard a Rails 7 project that uses this gem. I can setup and run the app, but rails test was throwing errors on ActionView::Template::Error: The asset "tailwind.css" is not present in the asset pipeline. Devs who had been on the project a while weren't getting that error.

Thanks to this issue, I first checked to ensure app/assets/build/ directory was present (it was), then looked for a app/assets/build/tailwind.css file inside (there was not), then ran rake assets:precompile manually to see if it generated the app/assets/build/tailwind.css file (it did). After which, the test ran cleanly.

So, like @pupeno, I'm unsure if the problem actually lies with this gem, or with Rails not actually precompiling assets properly, or what. But here are the symptoms in case they're useful!

@aluisioalves123
Copy link

Hello, I was having the same problem and when I was running rake assets:precompile it gave me this error message:
image

The problem was in the directory, the directory of my project was "Área de Trabalho" which means "Desktop" in portuguese (Im from Brazil).

So to solve the problem, I simply put my project folder in my root and then precompile it again.

Hope it helps

@flavorjones
Copy link
Member

@aluisioalves123 You're experiencing a different problem -- a bug reported at #184 and fixed at #197.

@flavorjones
Copy link
Member

@reefdog @pupeno Sorry you're experiencing problems. Although this gem hooks into the rake tasks test:prepare and db:test:prepare, you may still need to invoke assets:precompile or tailwindcss:build in your CI or deployment pipelines. Does that makes sense?

@stevepolitodesign
Copy link

I'm running into a similar issue, and want to reference rails/rails#47719 as a possible solution.

stevepolitodesign added a commit to thoughtbot/botcasts that referenced this issue May 13, 2023
There appears to be a [bug][1] with tailwindcss-rails, or possibly
Rails, that is affecting how assets are precompiled on a cloned
repository.

Prior to this commit, we would get the following error after cloning the
repo and running the test suite:

```text
ActionView::Template::Error: The asset 'tailwind.css' was not found in
the load path.
```
One solution is to run `test:prepare` in the setup script which will
generate the assets. There is an [open pull request][2] against Rails
that would introduce this change based on [similar feedback][3]

[1]: rails/tailwindcss-rails#158
[2]: rails/rails#47719
[3]: rails/rails#47210 (comment)
stevepolitodesign added a commit to thoughtbot/botcasts that referenced this issue May 18, 2023
There appears to be a [bug][1] with tailwindcss-rails, or possibly
Rails, that is affecting how assets are precompiled on a cloned
repository.

Prior to this commit, we would get the following error after cloning the
repo and running the test suite:

```text
ActionView::Template::Error: The asset 'tailwind.css' was not found in
the load path.
```
One solution is to run `test:prepare` in the setup script which will
generate the assets. There is an [open pull request][2] against Rails
that would introduce this change based on [similar feedback][3]

[1]: rails/tailwindcss-rails#158
[2]: rails/rails#47719
[3]: rails/rails#47210 (comment)
stevepolitodesign added a commit to thoughtbot/botcasts that referenced this issue May 18, 2023
There appears to be a [bug][1] with tailwindcss-rails, or possibly
Rails, that is affecting how assets are precompiled on a cloned
repository.

Prior to this commit, we would get the following error after cloning the
repo and running the test suite:

```text
ActionView::Template::Error: The asset 'tailwind.css' was not found in
the load path.
```
One solution is to run `test:prepare` in the setup script which will
generate the assets. There is an [open pull request][2] against Rails
that would introduce this change based on [similar feedback][3]

[1]: rails/tailwindcss-rails#158
[2]: rails/rails#47719
[3]: rails/rails#47210 (comment)
seanpdoyle pushed a commit to thoughtbot/botcasts that referenced this issue Jun 10, 2024
There appears to be a [bug][1] with tailwindcss-rails, or possibly
Rails, that is affecting how assets are precompiled on a cloned
repository.

Prior to this commit, we would get the following error after cloning the
repo and running the test suite:

```text
ActionView::Template::Error: The asset 'tailwind.css' was not found in
the load path.
```
One solution is to run `test:prepare` in the setup script which will
generate the assets. There is an [open pull request][2] against Rails
that would introduce this change based on [similar feedback][3]

[1]: rails/tailwindcss-rails#158
[2]: rails/rails#47719
[3]: rails/rails#47210 (comment)
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

5 participants