Skip to content

Commit

Permalink
Get ruthless with the component guide styles
Browse files Browse the repository at this point in the history
- put all the component sass back into the component guide styles
- create a new print stylesheet for the guide, containing all the component print styles
- remove the application stylesheet from the guide
- this removes all duplication of styles from the component guide and ensures that all components render correctly
- however it does mean the guide doesn't include the application styles, which would be useful for spotting conflicts/override problems, but the alternative wasn't working
  • Loading branch information
andysellick committed Mar 30, 2020
1 parent 68388af commit b3612a6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 2 additions & 0 deletions app/assets/stylesheets/component_guide/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
@import "govuk/helpers/all";
@import "govuk/core/all";

@import "govuk_publishing_components/all_components";

$gem-guide-border-width: 1px;

.component-list {
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/component_guide/print.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "govuk_publishing_components/all_components_print";
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
<%= csrf_meta_tags %>
<%= favicon_link_tag "govuk_publishing_components/favicon-production.png" %>

<%= stylesheet_link_tag "#{GovukPublishingComponents::Config.application_stylesheet}" %>
<%= stylesheet_link_tag "component_guide/application", media: "screen" %>

<% if GovukPublishingComponents::Config.application_print_stylesheet %>
<%= stylesheet_link_tag "#{GovukPublishingComponents::Config.application_print_stylesheet}", media: "print" %>
<% end %>
<%= stylesheet_link_tag "component_guide/print", media: "print" %>

<%= javascript_include_tag "govuk_publishing_components/vendor/modernizr" %>
<%= yield :extra_headers %>
Expand Down
1 change: 1 addition & 0 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
component_guide/application.js
component_guide/filter-components.js
component_guide/visual-regression.js
component_guide/print.css
govuk_publishing_components/all_components.js
govuk_publishing_components/modules.js
govuk_publishing_components/vendor/modernizr.js
Expand Down
4 changes: 2 additions & 2 deletions spec/component_guide/component_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
it "includes component guide styles and scripts" do
visit "/component-guide"
expect(page).to have_selector('link[href*="/assets/component_guide/application"]', visible: false)
expect(page).to have_selector('link[href*="/assets/component_guide/print"]', visible: false)
expect(page).to have_selector('script[src*="/assets/component_guide/application"]', visible: false)
end

it "includes the application’s styles and scripts" do
it "includes the application’s scripts" do
visit "/component-guide"
expect(page).to have_selector('link[href*="/assets/application"]', visible: false)
expect(page).to have_selector('script[src*="/assets/application"]', visible: false)
end

Expand Down

0 comments on commit b3612a6

Please sign in to comment.