Skip to content

Commit

Permalink
Add accessible-autocomplete
Browse files Browse the repository at this point in the history
The stylesheet couldn't be imported using the sass @import directive, so
instead we link to it as a separate stylesheet file instead of bundling
it in. This is probably more cache-friendly as the autocomplete upstream
CSS will change less frequently than our application bundle CSS.
  • Loading branch information
tvararu committed Sep 27, 2024
1 parent 14f2e75 commit 4658c92
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<title><%= page_title(@service_name) %></title>

<%= stylesheet_link_tag "accessible-autocomplete.min", "data-turbo-track": Rails.env.development? ? "" : "reload" %>
<%= stylesheet_link_tag "application", "data-turbo-track": Rails.env.development? ? "" : "reload" %>
<%= javascript_include_tag "application", "data-turbo-track": Rails.env.development? ? "" : "reload", defer: true %>
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

# 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/accessible-autocomplete/dist"
)

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"dependencies": {
"@hotwired/stimulus": "^3.2.2",
"@hotwired/turbo-rails": "^8.0.10",
"accessible-autocomplete": "^3.0.1",
"esbuild": "^0.24.0",
"govuk-frontend": "^5.6.0",
"idb": "^8.0.0",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,11 @@ abab@^2.0.6:
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291"
integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==

accessible-autocomplete@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/accessible-autocomplete/-/accessible-autocomplete-3.0.1.tgz#8ddf4934d0b4ba6acb28de486dd505e062cdc86e"
integrity sha512-xMshgc2LT5addvvfCTGzIkRrvhbOFeylFSnSMfS/PdjvvvElZkakCwxO3/yJYBWyi1hi3tZloqOJQ5kqqJtH4g==

acorn-globals@^7.0.0:
version "7.0.1"
resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3"
Expand Down

0 comments on commit 4658c92

Please sign in to comment.