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

Update Sass to modern syntax #3042

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Update Sass to modern syntax #3042

wants to merge 26 commits into from

Conversation

thisisdano
Copy link
Member

@thisisdano thisisdano commented Jan 5, 2025

Updates all project Sass to modern Sass syntax. A number of nice quality-of-life issues for devs. Speeds up compile time by about 2-3 seconds. (EDIT: Maybe not that much. Maybe I just got lucky. But it FEELS faster because you don't see all those errors scroll past.) Removes all kinds of noise from the terminal.

  • Updates Sass to modern use and forward syntax
  • Fixes nested rule order Sass deprecation
  • Uses a feature branch of uswds-compile to use modern Sass JS API
  • Removes livereload to prevent webrick failure noise in the terminal

Important

Based on work from #3041. We'll want to merge after that work, and change the base of this PR to main. It targets #3041 now to show only the relevant changes.

@thisisdano thisisdano changed the base branch from main to dw-update-design-assets January 6, 2025 06:43
Copy link
Member Author

@thisisdano thisisdano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added code comments

Comment on lines -23 to -29
// TODO: move to uswds once finished
$theme-site-cols-split: "tablet";
$theme-site-cols-show: "desktop";
$theme-grid-gap-default: "md";

$site-measure: 5;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all now in variables so they can be used properly

@@ -112,10 +101,10 @@ abbr[title="required"] {
$site-banner-icon-color: "blue-40v";
$site-banner-action-color: "gray-20";
@include typeset($site-banner-font-family);
background-color: color("ink");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They'll be a number of this type of change throughout, changing the order of rules to avoid splitting across nested rules...

@@ -453,7 +442,6 @@ abbr[title="required"] {
}

.site-subheading {
@include typeset-h6;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed entirely, since moving to bottom caused some font issues. All it gets us is uppercasing, which I addressed in the previous PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, to be fair, it DOES change the spacing a little between the eyebrow and the h1, but not enough to be an issue

@@ -1,3 +1,5 @@
@use "uswds-core" as *;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll see this in all the files now...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an index for easier forwarding

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And lo! Only the settings we use! This took a bunch of diff'ing, but now we only have one small(ish) settings group instead of a bunch of redundant settings over 6 separate files

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can now reference this single file from all our entry points

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved all the old settings to a directory for reference. We can possibly just delete them now.

Comment on lines +1 to +2
@forward "settings/uswds-site-theme";
@forward "uswds/packages/uswds";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way simpler!

@@ -43,10 +43,10 @@
"prestart": "npx gulp build",
"proof": "bundle exec htmlproofer --enforce-https=false --allow-missing-href=true --only_4xx --ignore-status-codes 403,429 --swap-urls 'https\\://designsystem.digital.gov/:/' --ignore-files '/whats-new/updates/(2017|2018|2019|2020|2021)/,/documentation/code-guidelines/' ./_site",
"proof:all": "bundle exec htmlproofer --enforce-https=false --allow-missing-href=true --ignore-status-codes 0 --swap-urls 'https\\://designsystem.digital.gov/:/' --ignore-files '/whats-new/updates/(2017|2018|2019|2020|2021)/,/documentation/code-guidelines/' ./_site",
"serve": "npm run build:all-assets && bundle exec jekyll serve --drafts --future --incremental --livereload --host=localhost",
"serve": "npm run build:all-assets && bundle exec jekyll serve --drafts --future --incremental --host=localhost",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ymmv, but for me livereload just isn't worth it. I get pages and pages of webrick errors in the console, which is way too noisy to notice anything of value. The time saved not just hitting command-R is negligable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth, I've pretty much exclusively used the local host link and not the live reload link in my time here ¯_(ツ)_/¯

@@ -97,7 +97,7 @@
},
"snyk": true,
"dependencies": {
"@uswds/compile": "1.2.1",
"@uswds/compile": "github:uswds/uswds-compile#dw-gulp-sass-update",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using a feature branch here where I fixed the Sass JS API deprecation issues. We can link it to a formal compile release when that exists

@thisisdano thisisdano marked this pull request as ready for review January 6, 2025 06:56
@thisisdano thisisdano requested a review from a team as a code owner January 6, 2025 06:56
@thisisdano thisisdano requested review from mejiaj and mahoneycm January 6, 2025 21:20
mejiaj
mejiaj previously approved these changes Jan 7, 2025
Copy link
Contributor

@mejiaj mejiaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I didn't run into issues on compile or notice any regressions.

Compile issues before/after.
capture -Warp-2025-01-07@2x

mahoneycm
mahoneycm previously approved these changes Jan 7, 2025
Copy link
Contributor

@mahoneycm mahoneycm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! No perceived regressions and no build errors.

Really happy to have this update 👏

@@ -43,10 +43,10 @@
"prestart": "npx gulp build",
"proof": "bundle exec htmlproofer --enforce-https=false --allow-missing-href=true --only_4xx --ignore-status-codes 403,429 --swap-urls 'https\\://designsystem.digital.gov/:/' --ignore-files '/whats-new/updates/(2017|2018|2019|2020|2021)/,/documentation/code-guidelines/' ./_site",
"proof:all": "bundle exec htmlproofer --enforce-https=false --allow-missing-href=true --ignore-status-codes 0 --swap-urls 'https\\://designsystem.digital.gov/:/' --ignore-files '/whats-new/updates/(2017|2018|2019|2020|2021)/,/documentation/code-guidelines/' ./_site",
"serve": "npm run build:all-assets && bundle exec jekyll serve --drafts --future --incremental --livereload --host=localhost",
"serve": "npm run build:all-assets && bundle exec jekyll serve --drafts --future --incremental --host=localhost",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth, I've pretty much exclusively used the local host link and not the live reload link in my time here ¯_(ツ)_/¯

Base automatically changed from dw-update-design-assets to main January 8, 2025 18:15
@heymatthenry heymatthenry dismissed stale reviews from mejiaj and mahoneycm January 8, 2025 18:15

The base branch was changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants