From 174cc31b8fcfb016fedfab96f2852822688a018e Mon Sep 17 00:00:00 2001 From: Jos Koetsier Date: Mon, 13 Sep 2021 20:47:13 +0100 Subject: [PATCH] Unpin Sprockets gem and upgrade to version 4. We had this pinned to version 3.7.2 because of a segmentation fault that occurred when upgrading to 4.0+ After investigation it seems that Sprockets now uses the manifest.js file to compile assets instead of the assets.rb file. See: https://github.com/sass/sassc-rails/issues/122 and https://github.com/rails/sprockets/blob/master/UPGRADING.md#manifestjs This commit upgrades Sprockets and now uses the manifest.js file to precompile assets which ensures the segmentation fault no longer occurs. --- Gemfile | 2 +- Gemfile.lock | 4 ++-- app/assets/config/manifest.js | 3 +++ config/initializers/assets.rb | 11 +---------- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index f47689bf3..4a3120aa8 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,7 @@ gem "rqrcode" gem "sassc-rails" gem "sentry-rails" gem "sentry-ruby" -gem "sprockets", "3.7.2" +gem "sprockets" gem "two_factor_authentication" gem "tzinfo-data" gem "uk_postcode", "~> 2.1" diff --git a/Gemfile.lock b/Gemfile.lock index 3011ea669..956e2b4a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -409,7 +409,7 @@ GEM spring (2.1.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (3.7.2) + sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.2) @@ -499,7 +499,7 @@ DEPENDENCIES simplecov simplecov-console spring-commands-rspec - sprockets (= 3.7.2) + sprockets timecop (~> 0.9.2) two_factor_authentication tzinfo-data diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 7d52bcf35..42047e2ed 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,3 +1,6 @@ //= link_tree ../images //= link_directory ../stylesheets .css //= link_directory ../javascripts .js +//= link accessible-autocomplete.min.css +//= link html5shiv.js +//= link govuk-logotype-crown.png diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index ebd5ef694..412091259 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,20 +3,11 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = "1.0" -Rails.application.config.assets.precompile += %w[ - govuk-logotype-crown.png - application_ie8.css - html5shiv.js - accessible-autocomplete.min.js - accessible-autocomplete.min.css - tick.svg - cross.svg -] - Rails.application.config.assets.paths += [ Rails.root.join("node_modules/govuk-frontend/govuk/assets/images"), Rails.root.join("node_modules/govuk-frontend/govuk/assets/fonts"), Rails.root.join("node_modules/govuk-frontend/govuk"), Rails.root.join("node_modules/govwifi-shared-frontend/dist"), Rails.root.join("node_modules/html5shiv/dist"), + Rails.root.join("vendor/assets/stylesheets"), ]