WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#53685 new defect (bug)

Update the `caniuse` database when running `grunt precommit:css`

Reported by: desrosj Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: css Cc:

Description

The autoprefixer dependency is responsible for applying browser specific prefixing and other changes to Core CSS generated from Sass files. It relies on the browserslist package, which in turn relies on the caniuse-lite database for determining which browser versions are supported for the project based on the browserslist field in the package.json file.

The caniuse-lite data is updated pretty frequently (several times a month), but unless it is manually updated, the data used is most likely outdated. This can result in unsupported browsers being considered supported due to outdated data.

When grunt precommit:css is run, the script should check whether browserslist is at the latest version to ensure the generated CSS supports the correct browsers.

The recommended way to do this is running npx browserslist@latest --update-db.

Change History (1)

#1 @desrosj
4 months ago

There is a bug to make note of. When running npx browserslist@latest --update-db, the indentation of the package-lock.json file is reverted to using 2 spaces instead of standard tabs.

There is a bug open for this. It appears to be a relic of old NPM versions, which always enforced 2 spaces for indentation. NPM 5.0+ detects indentation and preserves it when updating the lock file.

Note: See TracTickets for help on using tickets.