How to override USWDS variables?

Created on 28 June 2022, almost 2 years ago
Updated 18 March 2024, 3 months ago

Please forgive me if I'm missing something obvious -- I've been using a Classy-based theme with SASS for years, and this is my first venture into both USWDS and using npm, gulp, etc.

I'm trying to make a change to the default container width. The USWDS documentation says:

Set the default max width with $theme-grid-container-max-width in uswds-theme-spacing.scss.

I assume I'm not supposed to modify any of the actual USWDS files, since they could be updated at any time. So the first place that looked obvious to set this was in the sub theme's sass/_variables.scss file:

// Put any variable overrides here. For example:
// $color-primary: #666;
// $color-primary-darker: #444;
// $color-primary-darkest: #222;
$theme-grid-container-max-width: 1180px;

I figured this would then require a recompile, so I reran npx gulp compile, but this produced no change to the width of the container.

So the other place that looked plausible was in _uswds-theme.scss. I added the same line into "use ... with" and recompiled again -- still no change.

What's the right way to override settings like this in the subtheme?

πŸ’¬ Support request
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States wrd-oaitsd

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024