diff --git a/lib/install/upgrade_tailwindcss.rb b/lib/install/upgrade_tailwindcss.rb index b5389c73..53440aee 100644 --- a/lib/install/upgrade_tailwindcss.rb +++ b/lib/install/upgrade_tailwindcss.rb @@ -17,6 +17,18 @@ FileUtils.mv(POSTCSS_CONFIG_PATH, Rails.root, verbose: true) || abort end +if APPLICATION_LAYOUT_PATH.exist? + if File.read(APPLICATION_LAYOUT_PATH).match?(/"inter-font"/) + say "Strip Inter font CSS from application layout" + gsub_file APPLICATION_LAYOUT_PATH.to_s, %r{, "inter-font"}, "" + else + say "Inter font CSS not detected.", :green + end +else + say "Default application.html.erb is missing!", :red + say %( Please check your layouts and remove any "inter-font" stylesheet links.) +end + if system("npx --version") say "Running the upstream Tailwind CSS upgrader" command = Shellwords.join(["npx", "@tailwindcss/upgrade@next", "--force", "--config", TAILWIND_CONFIG_PATH.to_s]) @@ -32,17 +44,5 @@ abort end -if APPLICATION_LAYOUT_PATH.exist? - if File.read(APPLICATION_LAYOUT_PATH).match?(/"inter-font"/) - say "Strip Inter font CSS from application layout" - gsub_file APPLICATION_LAYOUT_PATH.to_s, %r{, "inter-font"}, "" - else - say "Inter font CSS not detected.", :green - end -else - say "Default application.html.erb is missing!", :red - say %( Please check your layouts and remove any "inter-font" stylesheet links.) -end - say "Compile initial Tailwind build" run "rails tailwindcss:build"