Skip to content

remove inter font before upgrading using the npx script #469

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

Merged
Merged
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
24 changes: 12 additions & 12 deletions lib/install/upgrade_tailwindcss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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"
Loading