Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure AssetHelper to load individual stylesheets #1622

Merged
merged 2 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
$govuk-compatibility-govuktemplate: false;
$govuk-use-legacy-palette: false;
$govuk-new-link-styles: true;
// The AssetHelper module is configured for this application to load individual stylesheets
// for components and views on pages where they are needed.

// This flag stops the font from being included in this application's
// stylesheet - the font is being served by Static across all of GOV.UK, so is
// not needed here.
$govuk-include-default-font-face: false;

@import "govuk_publishing_components/govuk_frontend_support";
@import "govuk_publishing_components/components/back-link";
@import "govuk_publishing_components/components/character-count";
@import "govuk_publishing_components/components/details";
@import "govuk_publishing_components/components/document-list";
@import "govuk_publishing_components/components/error-summary";
@import "govuk_publishing_components/components/fieldset";
@import "govuk_publishing_components/components/inset-text";
@import "govuk_publishing_components/components/panel";
@import "govuk_publishing_components/components/radio";
@import "govuk_publishing_components/components/warning-text";
// https://github.com/alphagov/govuk_publishing_components/blob/main/docs/set-up-individual-component-css-loading.md
37 changes: 22 additions & 15 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
<% content_for :body do %>
<div id="wrapper">
<%= render 'govuk_publishing_components/components/breadcrumbs', {
breadcrumbs: @breadcrumbs,
collapse_on_mobile: true
} %>
<main id="content" role="main">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render 'govuk_publishing_components/components/title', title: yield(:title) %>
<%= yield %>
</div>
</div>
</main>
</div>
<% end %>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<%= stylesheet_link_tag 'application', :media => "all", integrity: false %>
<title><%= yield :title %> - GOV.UK</title>
<%= yield :section_meta_tags %>
<%=
render_component_stylesheets
%>
</head>
<body>
<div id="wrapper">
<%= render 'govuk_publishing_components/components/breadcrumbs', {
breadcrumbs: @breadcrumbs,
collapse_on_mobile: true
} %>
<main id="content" role="main">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render 'govuk_publishing_components/components/title', title: yield(:title) %>
<%= yield %>
</div>
</div>
</main>
</div>
<%= yield :body %>
<%= javascript_include_tag 'test-dependencies' if Rails.env.test? %>
<%= javascript_include_tag 'application', integrity: false %>
</body>
</html>