File tree 2 files changed +13
-7
lines changed
2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -74,15 +74,19 @@ def executable(exe_path: DEFAULT_DIR)
74
74
end
75
75
76
76
def compile_command ( debug : false , **kwargs )
77
- [
77
+ command = [
78
78
executable ( **kwargs ) ,
79
79
"-i" , Rails . root . join ( "app/assets/stylesheets/application.tailwind.css" ) . to_s ,
80
80
"-o" , Rails . root . join ( "app/assets/builds/tailwind.css" ) . to_s ,
81
81
"-c" , Rails . root . join ( "config/tailwind.config.js" ) . to_s ,
82
- ] . tap do |command |
83
- command << "--minify" unless ( debug || rails_css_compressor? )
84
- command << "--postcss #{ Rails . root . join ( "config/postcss.config.js" ) } " if File . exist? ( Rails . root . join ( "config/postcss.config.js" ) )
85
- end
82
+ ]
83
+
84
+ command << "--minify" unless ( debug || rails_css_compressor? )
85
+
86
+ postcss_path = Rails . root . join ( "config/postcss.config.js" )
87
+ command += [ "--postcss" , postcss_path . to_s ] if File . exist? ( postcss_path )
88
+
89
+ command
86
90
end
87
91
88
92
def watch_command ( always : false , poll : false , **kwargs )
Original file line number Diff line number Diff line change @@ -158,15 +158,17 @@ def mock_local_tailwindcss_install
158
158
actual = Tailwindcss ::Commands . compile_command ( exe_path : dir )
159
159
assert_kind_of ( Array , actual )
160
160
assert_equal ( executable , actual . first )
161
- refute_includes ( actual , "--postcss config/postcss.config.js " )
161
+ refute_includes ( actual , "--postcss" )
162
162
163
163
config_file = Rails . root . join ( "config/postcss.config.js" )
164
164
FileUtils . mkdir_p ( Rails . root . join ( "config" ) )
165
165
FileUtils . touch ( config_file )
166
166
actual = Tailwindcss ::Commands . compile_command ( exe_path : dir )
167
167
assert_kind_of ( Array , actual )
168
168
assert_equal ( executable , actual . first )
169
- assert_includes ( actual , "--postcss #{ config_file } " )
169
+ assert_includes ( actual , "--postcss" )
170
+ postcss_index = actual . index ( "--postcss" )
171
+ assert_equal ( actual [ postcss_index + 1 ] , config_file . to_s )
170
172
end
171
173
end
172
174
end
You can’t perform that action at this time.
0 commit comments