From b07eb3b9c6feb3e8aa06587ad54eb7a88d1a2b2b Mon Sep 17 00:00:00 2001 From: Jon Kirwan <87758239+jon-kirwan@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:30:20 +0100 Subject: [PATCH] Configure builds - Create `dartsass.builds` initializer and add all Sass files to be compiled. See https://github.com/rails/dartsass-rails#configuring-builds - Create .keep - Update manifest file to use /builds directory - Ignore /builds Co-Authored-By: Martin Jones <28779939+MartinJJones@users.noreply.github.com> --- .gitignore | 2 ++ app/assets/builds/.keep | 0 app/assets/config/manifest.js | 18 +----------------- config/initializers/dartsass.rb | 24 ++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 app/assets/builds/.keep create mode 100644 config/initializers/dartsass.rb diff --git a/.gitignore b/.gitignore index 029c4fe937..8698237927 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ log/*.log tmp/ coverage public/assets +/app/assets/builds/* +!/app/assets/builds/.keep node_modules yarn-error.log spec/reports/pacts diff --git a/app/assets/builds/.keep b/app/assets/builds/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 502ebd5b43..272208548f 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -2,21 +2,5 @@ //= link all.js //= link application.js //= link test-dependencies.js -//= link application.css -//= link components/_calendar.css -//= link components/_metadata.css -//= link components/_subscribe.css - -//= link views/_calendars.css -//= link views/_cookie-settings.css -//= link views/_csv_preview.css -//= link views/_homepage.css -//= link views/_travel-advice.css -//= link views/_report-child-abuse.css -//= link views/_homepage_header.css - -//= link views/_local-transaction.css -//= link views/_location_form.css -//= link views/_popular_links.css -//= link views/_homepage_more_on_govuk.css +//= link_tree ../builds diff --git a/config/initializers/dartsass.rb b/config/initializers/dartsass.rb new file mode 100644 index 0000000000..4721a42735 --- /dev/null +++ b/config/initializers/dartsass.rb @@ -0,0 +1,24 @@ +app_stylesheets = { + "application.scss" => "application.css", + "components/_calendar.scss" => "components/_calendar.css", + "components/_metadata.scss" => "components/_metadata.css", + "components/_subscribe.scss" => "components/_subscribe.css", + "views/_calendars.scss" => "views/_calendars.css", + "views/_cookie-settings.scss" => "views/_cookie-settings.css", + "views/_csv_preview.scss" => "views/_csv_preview.css", + "views/_homepage_header.scss" => "views/_homepage_header.css", + "views/_homepage_more_on_govuk_new.scss" => "views/_homepage_more_on_govuk_new.css", + "views/_homepage_more_on_govuk.scss" => "views/_homepage_more_on_govuk.css", + "views/_homepage_new.scss" => "views/_homepage_new.css", + "views/_homepage.scss" => "views/_homepage.css", + "views/_inverse_header.scss" => "views/_inverse_header.css", + "views/_links_and_search.scss" => "views/_links_and_search.css", + "views/_local-transaction.scss" => "views/_local-transaction.css", + "views/_location_form.scss" => "views/_location_form.css", + "views/_popular_links.scss" => "views/_popular_links.css", + "views/_report-child-abuse.scss" => "views/_report-child-abuse.css", + "views/_travel-advice.scss" => "views/_travel-advice.css", +} + +all_stylesheets = app_stylesheets.merge(GovukPublishingComponents::Config.all_stylesheets) +Rails.application.config.dartsass.builds = all_stylesheets