Skip to content

Commit

Permalink
Merge pull request #1261 from alphagov/pubcomp40
Browse files Browse the repository at this point in the history
Upgrade and improve use of GOV.UK Publishing Components
  • Loading branch information
csutter authored Jul 25, 2024
2 parents e8a59bc + e484052 commit eb9fa01
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ GEM
govuk_personalisation (0.16.0)
plek (>= 1.9.0)
rails (>= 6, < 8)
govuk_publishing_components (39.2.2)
govuk_publishing_components (40.0.0)
govuk_app_config
govuk_personalisation (>= 0.7.0)
kramdown
Expand Down Expand Up @@ -418,7 +418,7 @@ GEM
opentelemetry-instrumentation-que (0.8.2)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-racecar (0.3.3)
opentelemetry-instrumentation-racecar (0.3.4)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-rack (0.24.5)
Expand Down Expand Up @@ -554,7 +554,7 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.3.1)
rexml (3.3.2)
strscan
rouge (4.3.0)
rspec-core (3.13.0)
Expand Down
1 change: 1 addition & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
//= link_tree ../builds
//= link application.js
//= link es6-components.js
6 changes: 3 additions & 3 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//= require_tree .
//= require govuk_publishing_components/dependencies
//= require govuk_publishing_components/all_components
// This file is required to exist by GOV.UK Publishing Components `layout_for_admin` component but
// currently doesn't need to contain any code. See `es6-components.js` where component JS is
// included.
7 changes: 7 additions & 0 deletions app/assets/javascripts/es6-components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//= require govuk_publishing_components/lib
//= require govuk_publishing_components/components/button
//= require govuk_publishing_components/components/checkboxes
//= require govuk_publishing_components/components/error-summary
//= require govuk_publishing_components/components/layout-header
//= require govuk_publishing_components/components/skip-link
//= require govuk_publishing_components/components/table
24 changes: 23 additions & 1 deletion app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
@import "govuk_publishing_components/all_components";
@import 'govuk_publishing_components/govuk_frontend_support';
@import 'govuk_publishing_components/component_support';
@import 'govuk_publishing_components/components/breadcrumbs';
@import 'govuk_publishing_components/components/button';
@import 'govuk_publishing_components/components/checkboxes';
@import 'govuk_publishing_components/components/document-list';
@import 'govuk_publishing_components/components/error-alert';
@import 'govuk_publishing_components/components/error-message';
@import 'govuk_publishing_components/components/error-summary';
@import 'govuk_publishing_components/components/heading';
@import 'govuk_publishing_components/components/hint';
@import 'govuk_publishing_components/components/input';
@import 'govuk_publishing_components/components/label';
@import 'govuk_publishing_components/components/layout-footer';
@import 'govuk_publishing_components/components/layout-for-admin';
@import 'govuk_publishing_components/components/layout-header';
@import 'govuk_publishing_components/components/search';
@import 'govuk_publishing_components/components/skip-link';
@import 'govuk_publishing_components/components/success-alert';
@import 'govuk_publishing_components/components/summary-list';
@import 'govuk_publishing_components/components/table';
@import 'govuk_publishing_components/components/textarea';
@import 'govuk_publishing_components/components/title';

.actions {
margin-bottom: govuk-spacing(6);
Expand Down
6 changes: 0 additions & 6 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ class Application < Rails::Application
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")

# Using a sass css compressor causes a scss file to be processed twice
# (once to build, once to compress) which breaks the usage of "unquote"
# to use CSS that has same function names as SCSS such as max.
# https://github.com/alphagov/govuk-frontend/issues/1350
config.assets.css_compressor = nil

# Set asset path to be application specific so that we can put all GOV.UK
# assets into an S3 bucket and distinguish app by path.
config.assets.prefix = "/assets/search-admin"
Expand Down
5 changes: 5 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,9 @@

# Ensure latest assets are always available when using Dart SASS in watch mode
config.assets.digest = false

# Force all the stylesheets from the `govuk_publishing_components` gem to be included in Dart Sass
# builds so we can use the component guide (without this, Sprockets will try and use the legacy
# SassC compiler to build them which we no longer include in this app)
config.dartsass.builds.merge!(GovukPublishingComponents::Config.all_stylesheets)
end
3 changes: 3 additions & 0 deletions config/initializers/govuk_publishing_components.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GovukPublishingComponents.configure do |config|
config.use_es6_components = true
end
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
get "/healthcheck/ready", to: GovukHealthcheck.rack_response(
GovukHealthcheck::ActiveRecord,
)
mount GovukPublishingComponents::Engine, at: "/component-guide" if Rails.env.development?

resources :boosts
resources :recommended_links, path: "/recommended-links"
Expand Down

0 comments on commit eb9fa01

Please sign in to comment.