-
Notifications
You must be signed in to change notification settings - Fork 187
Doesn't work without sprockets #62
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
Confirmed. After I've uncommented |
Hi @vfonic. Unfortunately, that error is unrelated to the Tailwind CSS Nova extension, but instead is related to the tailwindcss-rails gem. If you submit an issue there, hopefully someone should be able to help. The Tailwind CSS Nova extension in no way relies on Sprockets. Good luck! Thanks, |
This gem is designed to be used exclusively with the asset pipeline. It has no relevance for a Webpacker setup. You can just install Tailwind as normal for that. |
Perhaps that was true in the past, but it seems like the gem supports both Sprockets and Webpacker today.
The install generator checks whether the app uses Sprockets or Webpacker: https://github.com/rails/tailwindcss-rails/blob/main/lib/tasks/tailwindcss_tasks.rake#L3-L9 https://github.com/rails/tailwindcss-rails/blob/main/lib/tasks/tailwindcss_tasks.rake#L17-L20 Please reopen. Thanks! |
Lol, yes, forgot we added that. Not sure it’s a good idea to have dual purpose like this, though. |
I understand. It's a tough call to make. I'd argue that, since the introduction of Webpacker, many gems have opted for the dual purpose/support. It's just the way things are now. I think having dual support makes more sense than having to maintain two separate gems that could have a lot of shared functionality (things like: purger, compressor, etc.) |
Tailwind packed through Webpack has all those functions natively. This gem specifically implements those functions via Ruby for the asset pipeline. And then offers a slim, probably too-confusing wrapper on installing TW for Webpack. |
@dhh I could do two things:
I agree with your point that easiest way forward would be to just support asset pipeline and have one north star. Fix would include conditionals inside the require "tailwindcss/compressor" if defined?(Sprockets) # maybe also here
module Tailwindcss
class Engine < ::Rails::Engine
if defined?(Sprockets)
...
end
end
end That being said I'm not gonna lie, spined-up numerous webpacker apps and this generator was helpful, but... :) Main issue to use TW with asset pipeline is inability to use |
I think we should remove the webpack installer. This heart of this gem is a sprockets-specific approach to using TW with the asset pipeline. Let's just go with that. Re: @apply, yes, I agree, would be nice to have a a sprockets version of this. |
This is "fixed" here #64 |
I've just created a new rails app like this:
rails new app_name --skip-sprockets
Then I ran the two commands:
./bin/bundle add tailwindcss-rails
- worked fine./bin/rails tailwindcss:install
This second command fails with:
Since I'm planning on using Webpacker exclusively, I don't see the need for having to add Sprockets just to be able to use this gem. What do you think?
The text was updated successfully, but these errors were encountered: