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

Input/Output paths are hardcoded #438

Open
danwetherald opened this issue Nov 21, 2024 · 4 comments
Open

Input/Output paths are hardcoded #438

danwetherald opened this issue Nov 21, 2024 · 4 comments

Comments

@danwetherald
Copy link

Why would it make sense to hardcode and not allow configuration options for the bin/rails tailwindcss:watch command?

We would like to generate a separate smaller tailwind css file that is for an embedded iframe for example, this should only include the css for a small subset of views for performance reasons.

Any plans to allow for the cli to allow for config params rather than them being hardcoded?

@danwetherald danwetherald changed the title Input/Output paths are hardcoded - why? Input/Output paths are hardcoded Nov 21, 2024
@flavorjones
Copy link
Member

Hi @danwetherald, thanks for asking this question. It's nice to meet you.

Why would it make sense to hardcode

The contributors to this project have so far solved their problems without needing to introduce configurable paths. Hardcoded paths work fine in a vanilla Rails app.

If you have a different problem, that's great, let's talk about it. It's a weird flex to imply that the current implementation doesn't make sense because it doesn't meet your expectations.

We would like to generate a separate smaller tailwind css file that is for an embedded iframe for example, this should only include the css for a small subset of views for performance reasons

Rather than introduce configurable parameters for the commands, it may be more reasonable to use the Tailwindcss CLI directly on a custom tailwind.config.js file if you've got needs that aren't met by this gem. Have you explored that as an alternative option to this gem?

Like, if I'm being honest, there isn't much there there in this gem. It's basically:

  1. generator templates for scaffolding and auth (which it sounds like you don't need),
  2. a tailwind.config.js file (which it sounds like you want to heavily customize for your use case),
  3. a wrapper for running the TailwindCSS CLI with some hardcoded paths,
  4. and some glue for running those commands in a Procfile or in puma (which you can reproduce easily).

So I'm suggesting you just run the tailwind command you want with the config file that you need. The tailwindcss-ruby gem should make installation easy in case that's relevant.

Any plans to allow for the cli to allow for config params

This isn't a problem I personally have, so it's unlikely I'm going to do this work. And I'm not sure if the additional complexity is worth it without understanding your use case a bit more deeply. (The additional complexity comes from adding the first configuration option, of which this gem currently has zero.)

Also, if you haven't seen it already, there is a long-lived conversation going on at #355 which touches a bit on the config file and the subject of inputs and outputs. It's been hard to make a decision confidently while Tailwind v4 has been under development, but it sounds like a final release is due in the next few weeks, so I expect to pick that thread back up soon. It seems likely some configuration options will be introduced. Feel free to add your voice there if you wish.

@henrikbjorn
Copy link

@flavorjones I think that this use case might make sense to make it configurable activeadmin/activeadmin#8223

In our monolith we do something like this, since we have different Tailwind configs for our ActiveAdmin, our Marketing stuff, and our Account stuff. Which can be highly different.

So currently we are copy/pasting this ActiveAdmin rake task around for our different applications.

@flavorjones
Copy link
Member

flavorjones commented Nov 26, 2024

@henrikbjorn My question to you is the same that I asked above: if you're doing heavy customization already, why not use tailwindcss-ruby to install the CLI and just run the command with the specifialized configuration?

I'm trying to get a sense for whether tailwindcss-rails should even try to address the gem or engine use case.

@henrikbjorn
Copy link

@flavorjones Makes sense, it is easier to call the tailwind executables directly now with the new ruby gem.

My thought was to make it easier for the the compilation to hook into varius rake tests like asset precompilation and the test suite. But that wouldn't change just because the CLI here took additional arguments.

tldr; you are correct :)

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

3 participants