Skip to content

Using custom plugins with class name parsing/class name generation #5

@bkrmendy

Description

@bkrmendy

Hi! Is it possible to use custom plugins when parsing tailwind class names or generating tailwind class names? A minimal example/repro case for this is

import { parse } from "@xengine/tailwindcss-class-parser";

const config = {
  plugins: [
    function ({ addUtilities }) {
      const newUtilities = {
        ".text-shadow-md": {
          textShadow: "3px 3px 6px rgba(0, 0, 0, 0.2)",
        },
        ".text-shadow-lg": {
          textShadow: "4px 4px 8px rgba(0, 0, 0, 0.3)",
        },
      };

      addUtilities(newUtilities, ["responsive", "hover"]);
    },
  ],
};

console.log(parse("text-shadow-md", config));

Running this, I'd expect text-shadow-md to be resolved to the textShadow prop specified in the plugin, but instead I get the following:

{
  root: "text-shadow-md",
  kind: "error",
  message: "found \"fontSize, textColor\" plugins but unable to determine which one is matched to given value \"shadow-md\"."
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions