Skip to content

Use presets to override some classes #554

Answered by ben-rogerson
Limunce asked this question in Q&A
Discussion options

You must be logged in to vote

Hey there

Yes, presets is perfect for this.

Here's an example of the preset usage that's working in my tests:

// tailwind.config.js

const myConfigDefault = {
  theme: {
    boxShadow: {
      1: "old-shadow",
    },
  },
};

module.exports = {
  presets: [myConfigDefault],
  theme: {
    boxShadow: {
      1: "new-shadow",
    },
  },
};
// Usage

tw`shadow-1`;

// ↓ ↓ ↓ ↓ ↓ ↓

({
  "--tw-shadow": "new-shadow",
  "boxShadow": "var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)"
});

Does that help?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Limunce
Comment options

Answer selected by Limunce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants