File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 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)
7474 end
7575
7676 def compile_command ( debug : false , **kwargs )
77- [
77+ command = [
7878 executable ( **kwargs ) ,
7979 "-i" , Rails . root . join ( "app/assets/stylesheets/application.tailwind.css" ) . to_s ,
8080 "-o" , Rails . root . join ( "app/assets/builds/tailwind.css" ) . to_s ,
8181 "-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
8690 end
8791
8892 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
158158 actual = Tailwindcss ::Commands . compile_command ( exe_path : dir )
159159 assert_kind_of ( Array , actual )
160160 assert_equal ( executable , actual . first )
161- refute_includes ( actual , "--postcss config/postcss.config.js " )
161+ refute_includes ( actual , "--postcss" )
162162
163163 config_file = Rails . root . join ( "config/postcss.config.js" )
164164 FileUtils . mkdir_p ( Rails . root . join ( "config" ) )
165165 FileUtils . touch ( config_file )
166166 actual = Tailwindcss ::Commands . compile_command ( exe_path : dir )
167167 assert_kind_of ( Array , actual )
168168 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 )
170172 end
171173 end
172174 end
You can’t perform that action at this time.
0 commit comments