Skip to content

[v4] Tailwind CSS misinterprets custom text-shadow plugin as text size #17047

Closed
@DarthGigi

Description

@DarthGigi

What version of Tailwind CSS are you using?

v4.0.12

What build tool (or framework if it abstracts the build tool) are you using?

SvelteKit 2.18.0

What version of Node.js are you using?

v22.14.0

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction URL

https://github.com/DarthGigi/tailwind-v4-text-shadow-mvce

Describe your issue

Using a custom plugin to add text shadows causes tailwindcss to override the text size property, thinking text-shadow is a text size utility while it's not.

Image

This worked fine in v4.0.5 last time I checked, I'm not sure which release introduced this behavior.

Plugin code
import plugin from "tailwindcss/plugin";

const textShadowPlugin = plugin(function ({ matchUtilities, theme }) {
  matchUtilities(
    {
      "text-shadow": (value) => ({
        textShadow: value
      })
    },
    { values: theme("textShadow") }
  );
});

export default textShadowPlugin;
app.css
@import 'tailwindcss';
@plugin "./plugins/text-shadow.ts";

@theme {
	/* Text Shadow */
	--text-shadow-sm: 0 0px 2px var(--tw-shadow-color);
	--text-shadow: 0 0px 4px var(--tw-shadow-color);
	--text-shadow-lg: 0 0px 8px var(--tw-shadow-color);
	--tw-shadow-color: --alpha(oklch(0 0 0) / 50%);
}

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