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

Tailwindcss debug environment variable #504

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

r-sierra
Copy link

Hi, this PR adds an environment variable to generate non-minified assets as discussed in #400

Copy link
Member

@flavorjones flavorjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for drafting this! I'd like to simplify the environment variable check, and I'm not sure what to do if both the rake task argument is passed and the environment variable is set.

@@ -33,6 +33,34 @@ def setup
end
end

test ".compile_command debug environment variable" do
begin
Rails.stub(:root, File) do # Rails.root won't work in this test suite
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If debug: true is passed to compile_command but TAILWINDCSS_DEBUG is unset, which should take precedence? I think the environment variable probably should, but that's a weakly held opinion.

Regardless of which way you want it, I'd like test coverage for that case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the argument debug is false by default, I cannot test if the value was explicitly set to false without changing the methods signature. I would rather prefer having the environment variable take precedence, as we can check if it was explicitly set in the ENV hash

@@ -4,6 +4,7 @@ module Tailwindcss
module Commands
class << self
def compile_command(debug: false, **kwargs)
debug ||= ["true", "1"].include?(ENV["TAILWINDCSS_DEBUG"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to test for ENV["TAILWINDCSS_DEBUG"].present?

@r-sierra r-sierra requested a review from flavorjones February 24, 2025 14:20
@r-sierra
Copy link
Author

Hi @flavorjones, thanks for taking the time to review this changes. This is ready for another review.

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

Successfully merging this pull request may close these issues.

2 participants