From 81843f0c08c2f70b8076a0f52970ce57cb981c8b Mon Sep 17 00:00:00 2001 From: songtianlun Date: Fri, 17 Jan 2025 17:08:07 +0800 Subject: [PATCH] chore: remove unused jQuery and Bootstrap dependencies - Deleted the `add_jquery.js` file as jQuery is no longer needed. - Removed references to Bootstrap from the Gemfile and package.json. - Updated the application layout to reflect the removal of Bootstrap styles. - Adjusted the paginator HTML to use a class that aligns with the new styling. These changes streamline the asset pipeline by eliminating unused libraries, which can improve load times and reduce potential security vulnerabilities. The application now relies on alternative styling and JavaScript solutions. --- Gemfile | 2 -- Gemfile.lock | 3 --- app/javascript/add_jquery.js | 3 --- app/javascript/application.js | 7 ------- app/views/kaminari/_paginator.html.erb | 2 +- app/views/layouts/_header.html.erb | 2 +- app/views/layouts/application.html.erb | 2 +- app/views/static_pages/home.html.erb | 9 ++------- config/importmap.rb | 1 - config/initializers/assets.rb | 8 ++++---- config/routes.rb | 2 +- package.json | 3 --- test/integration/site_layout_test.rb | 2 +- test/integration/users_index_test.rb | 4 ++-- yarn.lock | 10 ---------- 15 files changed, 13 insertions(+), 47 deletions(-) delete mode 100644 app/javascript/add_jquery.js diff --git a/Gemfile b/Gemfile index 8a6b448..7e13f8c 100644 --- a/Gemfile +++ b/Gemfile @@ -70,8 +70,6 @@ group :test do gem "rails-controller-testing" end -gem "cssbundling-rails", "~> 1.4" - gem "jsbundling-rails", "~> 1.3" group :production do diff --git a/Gemfile.lock b/Gemfile.lock index c52afdc..f3dd077 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -102,8 +102,6 @@ GEM concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) - cssbundling-rails (1.4.1) - railties (>= 6.0.0) date (3.4.1) debug (1.10.0) irb (~> 1.10) @@ -441,7 +439,6 @@ DEPENDENCIES bootsnap brakeman capybara - cssbundling-rails (~> 1.4) debug faker (~> 3.5) guard (~> 2.19) diff --git a/app/javascript/add_jquery.js b/app/javascript/add_jquery.js deleted file mode 100644 index f1a04b2..0000000 --- a/app/javascript/add_jquery.js +++ /dev/null @@ -1,3 +0,0 @@ -import jquery from 'jquery' -window.jQuery = jquery -window.$ = jquery \ No newline at end of file diff --git a/app/javascript/application.js b/app/javascript/application.js index 070a143..4e55c1f 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,11 +1,4 @@ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails import "@hotwired/turbo-rails" -// import './add_jquery' - -// import "jquery/dist/jquery" -// import "bootstrap/dist/js/bootstrap" - -// import "./theme_switch" - import "./controllers" diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb index 6d38687..8a9e357 100644 --- a/app/views/kaminari/_paginator.html.erb +++ b/app/views/kaminari/_paginator.html.erb @@ -1,5 +1,5 @@ <%= paginator.render do -%> -
+