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.
This commit is contained in:
parent
0335ef4ed6
commit
81843f0c08
2
Gemfile
2
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
|
||||
|
@ -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)
|
||||
|
@ -1,3 +0,0 @@
|
||||
import jquery from 'jquery'
|
||||
window.jQuery = jquery
|
||||
window.$ = jquery
|
@ -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"
|
||||
|
@ -1,5 +1,5 @@
|
||||
<%= paginator.render do -%>
|
||||
<div class="join">
|
||||
<div class="join pagination">
|
||||
<%= first_page_tag unless current_page.first? %>
|
||||
<%= prev_page_tag unless current_page.first? %>
|
||||
<% each_page do |page| -%>
|
||||
|
@ -7,7 +7,7 @@
|
||||
backdrop-filter backdrop-blur-lg bg-opacity-30 border-b border-gray-200 border-transparent
|
||||
shadow-md min-h-0 h-12 px-8 lg:px-12">
|
||||
<div class="navbar-start">
|
||||
<%= link_to "sample app", root_url, id: "logo", class: "btn btn-ghost text-xl" %>
|
||||
<%= link_to "Today AI Weather", root_url, id: "logo", class: "btn btn-ghost text-xl" %>
|
||||
</div>
|
||||
<div class="navbar-end">
|
||||
<div class="hidden lg:flex">
|
||||
|
@ -5,7 +5,7 @@
|
||||
<title><%= full_title(yield(:title)) %></title>
|
||||
<%= render 'layouts/rails_default' %>
|
||||
<%= render 'layouts/shim' %>
|
||||
<%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
|
||||
<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
|
||||
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
|
||||
</head>
|
||||
|
||||
|
@ -2,19 +2,14 @@
|
||||
<div class="hero bg-base-200 min-h-screen">
|
||||
<div class="hero-content text-center">
|
||||
<div class="max-w-md">
|
||||
<h1 class="text-5xl font-bold">Welcome to the Sample App</h1>
|
||||
<h1 class="text-5xl font-bold">Welcome to the Today Ai Weather</h1>
|
||||
<p class="py-6">
|
||||
This is the home page for the
|
||||
<a href="https://www.railstutorial.org">Ruby on Rails Tutorial</a>
|
||||
Sample application.
|
||||
Today Ai Weather application.
|
||||
</p>
|
||||
<%= link_to "Sing up now!", signup_path, class:"btn btn-lg btn-primary" %>
|
||||
<%= link_to image_tag("rails.svg", alt:"Rails logo", width: "200"),
|
||||
"https://rubyonrails.org/" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%#= link_to image_tag("kitten.jpg", alt:"Kitten", width:"200") %>
|
||||
|
||||
|
||||
|
@ -5,4 +5,3 @@ pin "application"
|
||||
# pin "@hotwired/stimulus", to: "stimulus.min.js"
|
||||
# pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
|
||||
pin_all_from "app/javascript/controllers", under: "controllers"
|
||||
# pin "bootstrap", to: "bootstrap.min.js"
|
||||
|
@ -5,7 +5,7 @@ Rails.application.config.assets.version = "1.0"
|
||||
|
||||
# Add additional assets to the asset load path.
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap/dist/js")
|
||||
Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap-icons/font")
|
||||
Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap/dist/js")
|
||||
Rails.application.config.assets.precompile << "bootstrap.min.js"
|
||||
# Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap/dist/js")
|
||||
# Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap-icons/font")
|
||||
# Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap/dist/js")
|
||||
# Rails.application.config.assets.precompile << "bootstrap.min.js"
|
||||
|
@ -6,8 +6,6 @@
|
||||
"@hotwired/turbo-rails": "^8.0.12",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"bootstrap": "3",
|
||||
"bootstrap-icons": "^1.11.3",
|
||||
"jquery": "^3.7.1",
|
||||
"nodemon": "^3.1.9",
|
||||
"postcss": "^8.4.49",
|
||||
@ -15,7 +13,6 @@
|
||||
"sass": "^1.83.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build:css:compile": "sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules",
|
||||
"build:css:prefix": "postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css",
|
||||
"build:css": "yarn build:css:compile && yarn build:css:prefix",
|
||||
"watch:css": "nodemon --watch ./app/assets/stylesheets/ --ext scss --exec \"yarn build:css\"",
|
||||
|
@ -7,7 +7,7 @@ class SiteLayoutTest < ActionDispatch::IntegrationTest
|
||||
test "layout links" do
|
||||
get root_path
|
||||
assert_template "static_pages/home"
|
||||
assert_select "a[href=?]", root_url, count: 2
|
||||
assert_select "a[href=?]", root_url, count: 3
|
||||
assert_select "a[href=?]", about_url
|
||||
assert_select "a[href=?]", help_url
|
||||
assert_select "a[href=?]", contact_url
|
||||
|
@ -10,7 +10,7 @@ class UsersIndexTest < ActionDispatch::IntegrationTest
|
||||
log_in_as(@admin)
|
||||
get users_path
|
||||
assert_template "users/index"
|
||||
assert_select "ul.pagination"
|
||||
assert_select "div.pagination"
|
||||
|
||||
first_page_of_users = User.where(activated: true).page(1)
|
||||
# first_page_of_users.first.toggle!(:activated)
|
||||
@ -18,7 +18,7 @@ class UsersIndexTest < ActionDispatch::IntegrationTest
|
||||
assert user.activated?
|
||||
assert_select "a[href=?]", user_path(user), text: user.name
|
||||
unless user == @admin
|
||||
assert_select "a[href=?]", user_path(user), text: "delete"
|
||||
assert_select "a[href=?][data-turbo-method='delete']", user_path(user)
|
||||
end
|
||||
end
|
||||
|
||||
|
10
yarn.lock
10
yarn.lock
@ -322,16 +322,6 @@ binary-extensions@^2.0.0:
|
||||
resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz"
|
||||
integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==
|
||||
|
||||
bootstrap-icons@^1.11.3:
|
||||
version "1.11.3"
|
||||
resolved "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.11.3.tgz"
|
||||
integrity sha512-+3lpHrCw/it2/7lBL15VR0HEumaBss0+f/Lb6ZvHISn1mlK83jjFpooTLsMWbIjJMDjDjOExMsTxnXSIT4k4ww==
|
||||
|
||||
bootstrap@3:
|
||||
version "3.4.1"
|
||||
resolved "https://registry.npmjs.org/bootstrap/-/bootstrap-3.4.1.tgz"
|
||||
integrity sha512-yN5oZVmRCwe5aKwzRj6736nSmKDX7pLYwsXiCj/EYmo16hODaBiT4En5btW/jhBF/seV+XMx3aYwukYC3A49DA==
|
||||
|
||||
brace-expansion@^1.1.7:
|
||||
version "1.1.11"
|
||||
resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz"
|
||||
|
Loading…
Reference in New Issue
Block a user