Skip to content

Commit

Permalink
Remove Webpacker
Browse files Browse the repository at this point in the history
  • Loading branch information
fumimowdan committed Oct 18, 2023
1 parent f7eba1f commit a1391df
Show file tree
Hide file tree
Showing 17 changed files with 206 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ bin/terrafile
bin/konduit.sh
bin/fetch_config.rb
.byebug_history

/app/assets/builds/*
!/app/assets/builds/.keep
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ gem "puma", "~> 6.4"
gem "rails", "~> 7.0.8"
gem "sprockets-rails"
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
gem "webpacker"

gem "pagy"
gem "scenic"
Expand Down Expand Up @@ -83,3 +82,7 @@ gem "sidekiq", "~> 6.5"
gem "sidekiq-cron", "~> 1.10"

gem "mail-notify", "~> 1.1"

gem "dartsass-rails", "~> 0.5.0"

gem "importmap-rails", "~> 1.2"
23 changes: 13 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ GEM
dry-validation (~> 1.0, >= 1.0.0)
connection_pool (2.4.1)
crass (1.0.6)
dartsass-rails (0.5.0)
railties (>= 6.0.0)
sass-embedded (~> 1.63)
date (3.3.3)
debug (1.8.0)
irb (>= 1.5.0)
Expand Down Expand Up @@ -188,6 +191,7 @@ GEM
raabro (~> 1.4)
globalid (1.2.1)
activesupport (>= 6.1)
google-protobuf (3.24.4)
govuk-components (4.1.1)
html-attributes-utils (~> 1.0.0, >= 1.0.0)
pagy (~> 6.0)
Expand All @@ -205,6 +209,9 @@ GEM
multi_xml (>= 0.5.2)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
importmap-rails (1.2.1)
actionpack (>= 6.0.0)
railties (>= 6.0.0)
invisible_captcha (2.1.0)
rails (>= 5.2)
io-console (0.6.0)
Expand Down Expand Up @@ -295,8 +302,6 @@ GEM
rack (2.2.8)
rack-protection (3.1.0)
rack (~> 2.2, >= 2.2.4)
rack-proxy (0.7.6)
rack
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.8)
Expand Down Expand Up @@ -398,10 +403,12 @@ GEM
sanitize (6.1.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
sass-embedded (1.69.3)
google-protobuf (~> 3.23)
rake (>= 13.0.0)
scenic (1.7.0)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
semantic_range (3.0.0)
sentry-rails (5.12.0)
railties (>= 5.0)
sentry-ruby (~> 5.12.0)
Expand Down Expand Up @@ -451,11 +458,6 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webpacker (5.4.4)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand All @@ -475,6 +477,7 @@ DEPENDENCIES
bundler-audit
capybara
config (~> 4.2)
dartsass-rails (~> 0.5.0)
debug
devise (~> 4.9)
dotenv-rails
Expand All @@ -487,6 +490,7 @@ DEPENDENCIES
govuk-components (= 4.1.1)
govuk_design_system_formbuilder
httparty (~> 0.21)
importmap-rails (~> 1.2)
invisible_captcha
jbuilder
launchy
Expand Down Expand Up @@ -516,10 +520,9 @@ DEPENDENCIES
tzinfo-data
uk_postcode
web-console
webpacker

RUBY VERSION
ruby 3.1.3p185
ruby 3.1.4p223

BUNDLED WITH
2.1.4
2 changes: 1 addition & 1 deletion Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: bin/rails server -p $PORT
webpack: bin/webpack-dev-server
sass: bin/rails dartsass:watch
Empty file added app/assets/builds/.keep
Empty file.
5 changes: 4 additions & 1 deletion app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
//= link_tree ../images
//= link_directory ../stylesheets .css
//= link_tree ../builds
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
//= link_tree ../../../node_modules
3 changes: 3 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Sassy
@import 'govuk-frontend/govuk/all';
@import 'custom';
138 changes: 138 additions & 0 deletions app/assets/stylesheets/custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
.dashboard {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: 20px; /* Adjust this for your desired gap between columns */
}

.kpi-widget {
background-color: #1d70b8;
border-radius: 5px;
padding: 15px;
text-align: center;

.title {
font-size: 28px;
font-weight: bold;
color: #fff;
margin: 0;
padding: 0;
}

.subtitle {
font-size: 17px;
font-weight: bold;
color: #fff;
margin: 0;
padding: 0;
}

.value {
font-size: 70px;
font-weight: bold;
color: #fff;
display: block;
padding: 0;
margin: 0;
}

.value-small {
font-size: 24px;
font-weight: bold;
color: #fff;
display: block;
padding: 0;
margin: 0;
}
.value-smallest {
font-size: 20px;
font-weight: bold;
color: #fff;
display: block;
padding: 0;
margin: 0;
}

.kpi-table {
margin-top: 20px;
margin-bottom: 20px;
width: 100%;
text-align: left;
color: #fff;

th {
font-weight: bold;
padding: 5px;
}

td {
padding: 5px;
font-size: 20px;
}

a {
color: #fff;
text-decoration: none;
}
}
}

.applicants-table {
font-size: 15px;

.govuk-table__head {
position: sticky;
top: 0;
background-color: #fff;
box-shadow: 0 0.3px 0 #b1b4b6;
}

th {
vertical-align: middle;
text-align: center;
}

td:not(:nth-child(-n + 2)) {
width: 120px;
}
td {
vertical-align: middle;
}
tr.sla-breached {
background-color: #f8d7da;
}
}

.flash {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
width: 100%;
font-size: 1.2em;

&.notice {
color: #155724;
background-color: #d4edda;
border-color: #c3e6cb;
}

&.alert {
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
}
}

#search {
.row {
display: flex;
}

.column {
flex: 1;
}

.full-width {
width: 100%;
}
}
4 changes: 4 additions & 0 deletions app/javascript/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
import { initAll } from "govuk-frontend"

initAll();
21 changes: 9 additions & 12 deletions app/views/layouts/admin.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<link rel="shortcut icon" sizes="16x16 32x32 48x48" href="<%= asset_pack_url('media/images/favicon.ico') %>" type="image/x-icon" />
<link rel="mask-icon" href="<%= asset_pack_url('media/images/govuk-mask-icon.svg') %>" color="blue">
<link rel="apple-touch-icon" sizes="180x180" href="<%= asset_pack_url('media/images/govuk-apple-touch-icon-180x180.png') %>">
<link rel="apple-touch-icon" sizes="167x167" href="<%= asset_pack_url('media/images/govuk-apple-touch-icon-167x167.png') %>">
<link rel="apple-touch-icon" sizes="152x152" href="<%= asset_pack_url('media/images/govuk-apple-touch-icon-152x152.png') %>">
<link rel="apple-touch-icon" href="<%= asset_pack_url('media/images/govuk-apple-touch-icon.png') %>">

<%= stylesheet_pack_tag 'govuk', 'data-turbolinks-track': 'reload' %>

<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<link rel="shortcut icon" sizes="16x16 32x32 48x48" href="<%= asset_url('govuk-frontend/govuk/assets/images/favicon.ico') %>" type="image/x-icon" />
<link rel="mask-icon" href="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-mask-icon.svg') %>" color="blue">
<link rel="apple-touch-icon" sizes="180x180" href="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-apple-touch-icon-180x180.png') %>">
<link rel="apple-touch-icon" sizes="167x167" href="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-apple-touch-icon-167x167.png') %>">
<link rel="apple-touch-icon" sizes="152x152" href="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-apple-touch-icon-152x152.png') %>">
<link rel="apple-touch-icon" href="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-apple-touch-icon.png') %>">
<%= stylesheet_link_tag 'application', 'data-turbolinks-track': 'reload' %>

<%= javascript_importmap_tags %>
</head>

<body class="govuk-template__body app-body-class">
Expand Down Expand Up @@ -56,8 +55,6 @@
"Help" => "#", "Cookies" => "#", "Contact" => "#", "Terms and Conditions" => "#"
})
%>

<%= javascript_pack_tag 'govuk', 'data-turbolinks-track': 'reload' %>
</body>

</html>
20 changes: 9 additions & 11 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<link rel="shortcut icon" sizes="16x16 32x32 48x48" href="<%= asset_pack_url('media/images/favicon.ico') %>" type="image/x-icon" />
<link rel="mask-icon" href="<%= asset_pack_url('media/images/govuk-mask-icon.svg') %>" color="blue">
<link rel="apple-touch-icon" sizes="180x180" href="<%= asset_pack_url('media/images/govuk-apple-touch-icon-180x180.png') %>">
<link rel="apple-touch-icon" sizes="167x167" href="<%= asset_pack_url('media/images/govuk-apple-touch-icon-167x167.png') %>">
<link rel="apple-touch-icon" sizes="152x152" href="<%= asset_pack_url('media/images/govuk-apple-touch-icon-152x152.png') %>">
<link rel="apple-touch-icon" href="<%= asset_pack_url('media/images/govuk-apple-touch-icon.png') %>">
<link rel="shortcut icon" sizes="16x16 32x32 48x48" href="<%= asset_url('govuk-frontend/govuk/assets/images/favicon.ico') %>" type="image/x-icon" />
<link rel="mask-icon" href="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-mask-icon.svg') %>" color="blue">
<link rel="apple-touch-icon" sizes="180x180" href="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-apple-touch-icon-180x180.png') %>">
<link rel="apple-touch-icon" sizes="167x167" href="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-apple-touch-icon-167x167.png') %>">
<link rel="apple-touch-icon" sizes="152x152" href="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-apple-touch-icon-152x152.png') %>">
<link rel="apple-touch-icon" href="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-apple-touch-icon.png') %>">

<%= stylesheet_pack_tag 'govuk', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_link_tag 'application', 'data-turbolinks-track': 'reload' %>

<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_importmap_tags %>

<meta property="og:image" content="<%= asset_pack_url('media/images/govuk-opengraph-image.png') %>">
<meta property="og:image" content="<%= asset_url('govuk-frontend/govuk/assets/images/govuk-opengraph-image.png') %>">
</head>

<body class="govuk-template__body app-body-class">
Expand Down Expand Up @@ -55,8 +55,6 @@
"Help" => "#", "Cookies" => "#", "Contact" => "#", "Terms and Conditions" => "#", "Privacy" => privacy_path
})
%>

<%= javascript_pack_tag 'govuk', 'data-turbolinks-track': 'reload' %>
</body>

</html>
8 changes: 8 additions & 0 deletions bin/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh

if ! gem list foreman -i --silent; then
echo "Installing foreman..."
gem install foreman
fi

exec foreman start -f Procfile.dev "$@"
4 changes: 4 additions & 0 deletions bin/importmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby

require_relative "../config/application"
require "importmap/commands"
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults(7.0)

config.assets.paths << Rails.root.join("node_modules")
config.assets.paths << Rails.root.join("node_modules/govuk-frontend/govuk/assets")
config.autoload_paths << Rails.root.join("app/services")

# Configuration for the application, engines, and railties goes here.
Expand Down
4 changes: 4 additions & 0 deletions config/importmap.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Pin npm packages by running ./bin/importmap

pin "application", preload: true
pin "govuk-frontend", to: "https://ga.jspm.io/npm:[email protected]/govuk-esm/all.mjs", preload: true
1 change: 0 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added vendor/javascript/.keep
Empty file.

0 comments on commit a1391df

Please sign in to comment.