Skip to content

Commit a0b9ea4

Browse files
committed
[Fix rails#52570] Remove PWA views and routes if its an API only project
1 parent f98e3fb commit a0b9ea4

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

railties/lib/rails/generators/rails/app/app_generator.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ def delete_app_views_if_api_option
491491
remove_dir "app/views"
492492
else
493493
remove_file "app/views/layouts/application.html.erb"
494+
remove_dir "app/views/pwa"
494495
end
495496
end
496497
end

railties/lib/rails/generators/rails/app/templates/config/routes.rb.tt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ Rails.application.routes.draw do
55
# Can be used by load balancers and uptime monitors to verify that the app is live.
66
get "up", to: "rails/health#show", as: :rails_health_check
77

8+
<%- unless options.api? -%>
89
# Render dynamic PWA files from app/views/pwa/*
910
get "service-worker", to: "rails/pwa#service_worker", as: :pwa_service_worker
1011
get "manifest", to: "rails/pwa#manifest", as: :pwa_manifest
1112

13+
<%- end -%>
1214
# Defines the root path route ("/")
1315
# root "posts#index"
1416
end

0 commit comments

Comments
 (0)