Skip to content

Custom utility with 2 or more declarations are not applied correctly #4303

Open
@MuhammadM1998

Description

@MuhammadM1998

Environment

  • Operating System: Linux
  • Node Version: v20.12.0
  • Nuxt Version: 3.17.3
  • CLI Version: 3.25.1
  • Nitro Version: 2.11.12
  • Package Manager: [email protected]
  • Builder: -
  • User Config: modules, devtools, compatibilityDate, future, css
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Is this bug related to Nuxt or Vue?

Nuxt

Version

v3.1.3

Reproduction

https://codesandbox.io/p/devbox/nuxt-ui3-n3sxks

Description

We're defining our typography style guide as custom utilities that consist of font-size and font-weight declarations like so

/* main.css */
@import 'tailwindcss'
@import 'nuxt/ui'

@utility text-display-1 {
  font-size: 54px;
  font-weight: 600;
}

@utility text-display-2 {
  ...
}

When applying custom utilities to Nuxt UI components, whether globally in app.config or individually via the ui prop, only one class is applied, and the other is discarded. For example, with the Button component has text-sm font-medium applied by default to the base slot, passing text-display-1 to that slot only overrides the size (blue arrow in the screenshot) while the weight still uses the font-medium class (red arrows in the screenshot)

Image

Commenting either one of the classes applies the other correctly. The problem happens only if there are two (or more?) classes

Additional context

We workaround this by marking the class as important !text-display-1

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagev3#1289

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions