Allow customizing input/output via env variables#577
Conversation
The Rails `assets:precompile` task internally calls `bin/rails tailwindcss:build`, which uses hardcoded input/output file paths. Previously, the only way to customize these paths was to bypass the Rails integration entirely and use the Tailwind CLI directly (via `bundle exec tailwindcss`). This change introduces TAILWINDCSS_INPUT_FILE and TAILWINDCSS_OUTPUT_FILE environment variables that allow users to override the default paths while still using the standard `assets:precompile` workflow. This is useful for projects with non-standard asset structures or when integrating with custom build pipelines.
be95b05 to
be03a48
Compare
|
Hi @thewatts, thanks for suggesting this change. I'd like to understand the problem you're hoping to solve -- that is, why do you want to change these file names? I'm asking questions because this implementation seems like it's only a partial solution that doesn't address the many places these paths are assumed after installation:
And I'm hoping that by understanding what problem is driving your contribution, that I can make some helpful suggestions. Thank you! |
|
Hi @flavorjones, I just found this PR, since I have the same wish as @thewatts to be able to customize the input and output file(s). 😄 I understand that this is not a trivial change, since as you mentioned the default paths are assumed at different locations, but maybe it's worthwile adding this customization nevertheless? |
The Rails
assets:precompiletask internally callsbin/rails tailwindcss:build, which uses hardcoded input/output file paths. Previously, the only way to customize these paths was to bypass the Rails integration entirely and use the Tailwind CLI directly (viabundle exec tailwindcss).This change introduces TAILWINDCSS_INPUT_FILE and TAILWINDCSS_OUTPUT_FILE environment variables that allow users to override the default paths while still using the standard
assets:precompileworkflow.This is useful for projects with non-standard asset structures or when integrating with custom build pipelines.