Make WordPress Core

Opened 11 days ago

Closed 6 days ago

Last modified 6 days ago

#62142 closed task (blessed) (fixed)

Sass Deprecation warnings during build process.

Reported by: peterwilsoncc's profile peterwilsoncc Owned by: peterwilsoncc's profile peterwilsoncc
Milestone: 6.7 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: css Cc:

Description

Sass has updated it's colour functions and they are showing deprecation warnings (ie nothing fatal) during the build process.

Various sass files will need to be updated in WordPress-Develop to resolve these.

  1. Run nvm use; npm i
  2. Run npm run grunt clean:qunit; npm run build:dev
  3. Observe the deprecation warnings

An example follows but there are several more:

Deprecation Warning: lighten() is deprecated. Suggestions:

color.scale($color, $lightness: 15.9375%)
color.adjust($color, $lightness: 7%)

More info: https://sass-lang.com/d/color-functions

   ╷
58 │ $adminbar-input-background: lighten( $menu-background, 7% ) !default;
   │                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    src/wp-admin/css/colors/_variables.scss 58:29  @import
    src/wp-admin/css/colors/_admin.scss 2:9        @import
    src/wp-admin/css/colors/blue/colors.scss 14:9  root stylesheet

Change History (5)

#1 @aslamdoctor
10 days ago

This is a recent deprecation from latest version of sass package.

  1. We have to either check for all the sass files for these deprecations and fix all one by one by using recommended method e.g. color.adjust($color, $lightness: 7%). This also includes other methods like darken(), desaturate() etc.
  1. Or we have to silence the warnings as mentioned here

https://sass-lang.com/documentation/breaking-changes/legacy-js-api/#silencing-warnings
We can do this inside Gruntfile.js

Last edited 10 days ago by aslamdoctor (previous) (diff)

This ticket was mentioned in PR #7511 on WordPress/wordpress-develop by veryard.


6 days ago
#2

  • Keywords has-patch added; needs-patch removed

Went through the SCSS files and resolved deprecated warnings for older color functions. Happy to fix anything I may have missed.

https://sass-lang.com/documentation/breaking-changes/color-functions/

Trac ticket: https://core.trac.wordpress.org/ticket/62142

#3 @veryard
6 days ago

Hello!

I went ahead and made a PR to resolve the deprecation warnings, I've worked with some super legacy versions of sass and it just feels right to resolve it rather than omitting it. Have attached a screenshot of the logs no longer showing SCSS color function warnings.

Thanks

https://i.imgur.com/usweekk.png

#4 @peterwilsoncc
6 days ago

  • Owner set to peterwilsoncc
  • Resolution set to fixed
  • Status changed from new to closed

In 59185:

Tests/Build Tools: Update SCSS files to use new color functions.

Replaces deprecated color functions with their updated equivalents, see the deprecation documentation.

This results in four changes in the built files, hsl colors with a negative lightness value are replaced with the keyword black. These changes are harmless as they have no effect on the rendered colors.

Props aslamdoctor, veryard.
Fixes #62142.

Note: See TracTickets for help on using tickets.