-
Notifications
You must be signed in to change notification settings - Fork 186
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
lib/tailwindcss/commands.rb
Outdated
@@ -4,6 +4,7 @@ module Tailwindcss | |||
module Commands | |||
class << self | |||
def compile_command(debug: false, **kwargs) | |||
debug ||= ["true", "1"].include?(ENV["TAILWINDCSS_DEBUG"]) |
There was a problem hiding this comment.
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?
Hi @flavorjones, thanks for taking the time to review this changes. This is ready for another review. |
Hi, this PR adds an environment variable to generate non-minified assets as discussed in #400