Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@apply not working reliably in plugins since since 3.x #7002

Closed
ccaspers opened this issue Jan 10, 2022 · 2 comments
Closed

@apply not working reliably in plugins since since 3.x #7002

ccaspers opened this issue Jan 10, 2022 · 2 comments

Comments

@ccaspers
Copy link

ccaspers commented Jan 10, 2022

What version of Tailwind CSS are you using?

For example: v3.0.12

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

  • vue-cli 5.0.0-rc.1
  • webpack 5.64.4
  • postcss 8.4.5
  • postcss-loader 6.2.1

What version of Node.js are you using?

For example: v16.13.0

What browser are you using?

  • Firefox
  • Chrome

What operating system are you using?

Linux

Reproduction URL

https://play.tailwindcss.com/wUdEGR484y?file=config

Describe your issue

In a project I am currently working on, we rely on tailwind plugins to organize certain CSS styles. These plugins reuse Tailwind classes via @apply rules in JavaScript like this:

const plugin = require("tailwindcss/plugin");

module.exports = plugin(({ addUtilities }) => {
  const myUtils = {
    ".util": {
      "@apply text-red-500": {},
    },
    "@screen sm": {
      ".util": {
        ["@apply text-green-500"]: {},
      },
    },
  };
  addUtilities(myUtils);
});

We are currently migrating to Tailwind 3 which broke some of the styles that were created using @apply in plugins. Please have a look at the linked reproduction in Tailwind Play (thx to @crswll for helping me with this)

@thecrypticace
Copy link
Contributor

This looks to have been fixed in #6999. The release fixing this will go out tomorrow.

@ccaspers
Copy link
Author

That's great news. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants