Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jekyll-tailwindcss.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Gem::Specification.new do |spec|
spec.bindir = "exe"
spec.require_paths = ["lib"]
spec.add_dependency "tailwindcss-ruby"
spec.add_dependency "os"
end
5 changes: 4 additions & 1 deletion lib/tailwindcss/commands.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
require "tailwindcss/ruby"
require "os"

module Tailwindcss
module Commands
class << self
def compile_command(debug: false, config_path: nil, postcss_path: nil, **kwargs)
executable = Tailwindcss::Ruby.executable(**kwargs).to_s

command = [
Tailwindcss::Ruby.executable(**kwargs),
"#{(OS.windows? && executable.include?(" ")) ? "\"%s\"" : "%s"}" % executable,
"--input", "-"
]
command += ["--config", config_path] if config_path
Expand Down
6 changes: 3 additions & 3 deletions spec/jekyll/converters/tailwindcss_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
let(:mock_stdout) { instance_double(IO, read: css_content) }
let(:mock_stderr) { instance_double(IO, read: error_message) }

let(:compile_command_regex) { /.+\/tailwindcss --input -$/ }
let(:compile_command_regex) { /.+\/tailwindcss"? --input -$/ }
Copy link

Copilot AI Apr 9, 2025

Choose a reason for hiding this comment

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

The regex only accounts for an optional trailing quote after 'tailwindcss'. If the executable is fully quoted (with both leading and trailing quotes), this pattern may not match correctly. Consider updating the regex to optionally match both a leading and trailing quote.

Copilot uses AI. Check for mistakes.
let(:compile_arguments) { ["--input", "-"] }

before do
Expand Down Expand Up @@ -121,7 +121,7 @@
}
}
end
let(:compile_command_regex) { /.+\/tailwindcss --input - --config tailwind.config.js$/ }
let(:compile_command_regex) { /.+\/tailwindcss"? --input - --config tailwind.config.js$/ }
Copy link

Copilot AI Apr 9, 2025

Choose a reason for hiding this comment

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

The regex adjustment only considers an optional trailing quote. This may fail to match a fully quoted executable path. Consider modifying the regex to optionally allow both leading and trailing quotes.

Suggested change
let(:compile_command_regex) { /.+\/tailwindcss"? --input - --config tailwind.config.js$/ }
let(:compile_command_regex) { /"?\/tailwindcss"? --input - --config tailwind.config.js$/ }

Copilot uses AI. Check for mistakes.
let(:compile_arguments) { ["--input", "-", "--config", "./tailwind.config.js"] }

it "calls the tailwindcss CLI" do
Expand Down Expand Up @@ -150,7 +150,7 @@
}
}
end
let(:compile_command_regex) { /.+\/tailwindcss --input - --config other_location$/ }
let(:compile_command_regex) { /.+\/tailwindcss"? --input - --config other_location$/ }
Copy link

Copilot AI Apr 9, 2025

Choose a reason for hiding this comment

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

The updated regex only checks for an optional trailing quote after 'tailwindcss'. To fully support cases where the executable is enclosed in quotes, update the regex to optionally match both leading and trailing quotes.

Suggested change
let(:compile_command_regex) { /.+\/tailwindcss"? --input - --config other_location$/ }
let(:compile_command_regex) { /.*\/"?tailwindcss"? --input - --config other_location$/ }

Copilot uses AI. Check for mistakes.
let(:compile_arguments) { ["--input", "-", "--config", "./other_location"] }

it "uses custom config location" do
Expand Down