-
Notifications
You must be signed in to change notification settings - Fork 186
Rails 7.0.2.3 + Tailwind is not working, css style is not load #160
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
I'm having a similar issue - new project on |
I found the solution for my problem - it was that |
Hi @philipithomas, i tried your solution, adding |
Ah, i found the solution, when i'm creating the controller, i'm extend |
i think the problem was the command, generate it with --css tailwindcss instead |
I ran into a similar issue with some classes not loading. Adding config.assets.debug = true fixed the issue. is config.assets.debug = true required for tailwind CSS to function locally? If so should it be included in the readme? |
I was facing the same issue. Adding config.assets.debug = true hasn't done anything. Then, rake tailwindcss:build command in bash solved my issue. |
Thanks @Khondaker97 you saved me some time! |
What's about
and
|
Required for tailwind to work properly as it wasn't using the styles generated by tailwind <rails/tailwindcss-rails#160 (comment)>
Adding |
rails 7 |
I can't replicate these issues on Rails 7.0.5 with tailwind-rails 2.0.29. TW styles load as they should. There's no |
I have the same issue none of these is working: This suddenly happened after generating and using a new viewcomponent |
Just run this in the background “rails tailwindcss:watch” ( open new terminal and run this, it will cause rebuilding every time your css changed) |
I managed to get an existing application in such a state. This application uses I couldn't reproduce this on a freshly generated application with Is there anything I could do to pinpoint how my app got into this state? |
using ./bin/dev works. My mistake was using rails s |
I had the problem described here (using bin/dev). Updating So I realized that might be a cache problem. No changes were necesary however I am not sure how my local env got in that weird state. 🤷 |
I had similiar issue like this, I tried everything which everyone said, it dosen't work ..
|
This works for my too. Thanks legend rails: 7.0.6 |
I also experienced this issue and figured out that for some reason my fresh Rails 7.0.6 app installed old tailwindcss-rails (2.0.16). Upgrading it solved the issue without having to set
|
While working on a slim viewcomponent I encountered this issue with:
(I believe these are all the most recent versions) Very basic classes like As others have noted, adding |
|
Same issue. Tried to create 4 different projects. What ended up working was running |
It seems like there might be different causes for this issue. For me, the following fixed it: add the following line on assets.rb:
Then, run the following commands:
|
I had the issue where new styles I added to application.tailwind.css didn't seem to get picked up by tailwinds build process, I tried all the suggesting in this thread; I decided to try moving my styles outside of the I have no idea why, or what caused it in the first place as it was working with this:
And now I have to do this:
Hopefully someone can explain it, but thought I'd leave this here incase anyone else stumbles across this thread like I did. |
Don't forget to add stylesheet tag to application layout if you install Tailwind manually
|
On latest versions of everything, styles still aren't compiling. |
This worked for me. Thank you |
using ruby 3.3 config.assets is deprecated and throws an error not sure what the new fix is? |
I am not able to see anything instead of tooltip button in the view file i have added.. |
I was having a similar issue where my styles were not loading even though I had added the gem with "bundle" My config: This command solved it for me: In my case what happened was that I ran "bundle" but didn't actually install it. In case anyone else stumbles across this, try installing first. |
for me it was because I accidentally deleted Sprockets from my Gemfile and that was needed |
I'm using When running Adding this stylesheet code resolved my issue. |
Had to manually set |
Manually setting
I start my server with a Procfile that looks like this
Which was inteended to watch any changes on my files and live reload the page, but after running precompile it was not live reloading the changes, then I deleted the generated folder from precompile, and now it is all working fine. Not sure if this was the best solution and not really sure the why this works, but it works for me. My environment: MacOS Sonoma 14.4 |
rake assets:precompile solved it for me. Thanks. |
Nothing is working for me -- have tried all of the above. Repos that other people have created do work for me, just not if I start a new Rails project with |
did and it works now. |
Rails 7.1.3.2, after generating new app with |
I found a solution here: https://discuss.rubyonrails.org/t/rails-7-tailwind-not-refreshing-css/79736/4
You can delete
No need to set |
None of the above worked for me. Instead, it seems like the issue was related to the presence of either a space or parenthesis in my project's file path. More detail here: tailwindlabs/tailwindcss#10485 Once I removed spaces and parentheses from the file path, it worked. |
This was the solution for me, because for some reason I've previosuly run Deleting the My environment:
|
Running |
Thank you! |
I ran into the same issue. Like @ardifirmansyah8 (thank you so much!) commented all the way up top, I corrected my file as following:
|
I had run into this issue, and it turns out it's because I had run
So if you try deleting that manifest file then restart your server styles should start loading. |
I had a similar issue but, with Rails 8 and "tailwindcss-rails", "~> 3.0", where not all Tailwind classes were loading properly. Initially, I tried several solutions, including:
For a while, I ignored the problem, but when I needed to use custom Tailwind classes, I realized they weren't being detected at all. That’s when I found this [Reddit post] mentioning What do that command do?"You can precompile the assets in app/assets using rake assets:precompile, and remove older compiled assets using rake assets:clean. The rake assets:clean task allows for rolling deploys that may still be linking to an old asset while the new assets are being built. If you want to clear public/assets completely, you can use rake assets:clobber." [Stackoverflow post] My Fix
Now, everything works fine without modifying development environment configuration. Why did setting -p 3000 fix it?By default, the Rails server runs on port 3000. However, if the server starts on a different port, the tailwindcss:watch process might not detect file changes correctly, leading to issues with CSS not updating as expected. Explicitly setting the server to run on port 3000 ensures that both the Rails server and the Tailwind watcher are aligned, allowing for proper detection of file changes and live CSS updates. For more details, you can refer to the tailwindcss-rails README, which provides information on configuring the Tailwind watcher and ensuring it works seamlessly with your Rails server. TakeawayAlways check the logs first! 😆 I spent so much time looking in the wrong places when the issue was simply the port. Hopefully, this helps someone else facing a similar problem! |
You will need to let tailwind scan files under components folder, allow it in tailwind config |
Adding |
Let me share my experience. Still with the same problem but I got a partial change, so someone can keep exploring. |
Hi, i tried to create new rails 7 project with
--css tailwind
command. But, when i tried to run the server using./bin/dev
, tailwind style is not load. What is i'm missing??The text was updated successfully, but these errors were encountered: