Skip to content

Non-canonical class is being suggested as canonical, despite using different units #1548

@dslatkin

Description

@dslatkin

Specifically, for a utility like translate-y-0.25, I am getting the following warning using up-to-date VS Code, Tailwind extension, and package.json dependencies:

The class translate-y-0.25 can be written as translate-y-px (suggestCanonicalClasses)

The issue is that the original class translate-y-0.25 turns into translate: 0 0.0625rem, but the suggested class uses translate: 0 1px, but that changes the units.

With rem units, the original class is 1px only if a user has set 16px as their base font size, which is common but not guaranteed as users can override this in settings. The suggested class with pixel units, however, is always 1px as it does not scale with base font size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions