Git Product home page Git Product logo

Comments (10)

vfonic avatar vfonic commented on August 15, 2024 1

Perhaps that was true in the past, but it seems like the gem supports both Sprockets and Webpacker today.
As per README:

Tailwind CSS for Rails works with both the asset pipeline and Webpacker.

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!

from tailwindcss-rails.

dhh avatar dhh commented on August 15, 2024 1

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.

from tailwindcss-rails.

vfonic avatar vfonic commented on August 15, 2024

Confirmed. After I've uncommented require "sprockets/railtie" in config/application.rb, the installation succeeded.

from tailwindcss-rails.

jasonplatts avatar jasonplatts commented on August 15, 2024

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,
Jason

from tailwindcss-rails.

dhh avatar dhh commented on August 15, 2024

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.

from tailwindcss-rails.

dhh avatar dhh commented on August 15, 2024

Lol, yes, forgot we added that. Not sure it’s a good idea to have dual purpose like this, though.

from tailwindcss-rails.

vfonic avatar vfonic commented on August 15, 2024

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.)

from tailwindcss-rails.

dhh avatar dhh commented on August 15, 2024

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.

from tailwindcss-rails.

dixpac avatar dixpac commented on August 15, 2024

@dhh I could do two things:

  1. Fix this issue and continue to support webpack
  2. Drop webpack support

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 engine.rb(or somekind of conditionals :))

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 @apply out of the box. Every TW production app that I've worked with used @apply to extract common components such as button. Using @apply is maybe anti-pattern if we look at the TW idea, but without it some kind of componentization(view_component,partials) would be "necessary"

from tailwindcss-rails.

dixpac avatar dixpac commented on August 15, 2024

This is "fixed" here #64

from tailwindcss-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.