rails / cssbundling-rails

Bundle and process CSS in Rails with Tailwind, PostCSS, and Sass via Node.js.
MIT License
579 stars 83 forks source link

Do I need cssbundling-rails or tailwindcss-rails #75

Closed andrespch closed 2 years ago

andrespch commented 2 years ago

Sorry if this is not the right channel for questions.

I'm trying to integrate tailwind css into my rails app (6.1.4). I'm confuse about what's the best way to go taking into account that I'd like to upgrade to 7 as soon as possible. Do I need to move to css-bundling or is tailwindcss-rails preferable?

thanks in advance!

jltml commented 2 years ago

I'm not completely knowledgable, but if it's of any help, I think I'd definitely recommend cssbundling-ralis — tailwindcss-rails doesn't really provide any options for configuration and instead relies on the standalone precompiled version of Tailwind (which means no tailwind.config.js file nevermind… see edit). The latter is simpler, but the former is much more flexible, and ended up being the right choice for me after trying tailwindcss-rails. Hopefully this is a little helpful!

Edit: it seems that I'm either misremembering or that tailwindcss-rails has progressed since October — its README mentions that you can configure it with tailwind.config.js. So maybe I'm wrong on that front. I'm not sure how third-party plugins work with it, though.

dhh commented 2 years ago

@andrespch If you don't have any other reason to include node in your application, I would definitely suggest just using tailwindcss-rails, since there's no node dependency. If you need node for other JavaScript setups or otherwise, stick with cssbundling.

dhh commented 2 years ago

Recorded the difference here: https://github.com/rails/cssbundling-rails/blob/main/README.md#how-does-this-compare-to-tailwindcss-rails-and-dartsass-rails