postcss-each icon indicating copy to clipboard operation
postcss-each copied to clipboard

Issue in combination with Tailwind @apply

Open DirkWolthuis opened this issue 4 years ago • 1 comments

Hi, using latest version I get the following error:

 postcss: src/components/nes-grid/nes-grid.css, line: 470: src/components/nes-grid/nes-grid.css
           The `$(icon):nes-gap-2` class does not exist. If you're sure that `$(icon):nes-gap-2` exists, make sure that
           any `@import` statements are being properly processed before Tailwind CSS sees your CSS, as `@apply` can
           only be used for classes in the same CSS tree.

With this code:

@each $icon in sm, md {
  .icon-$(icon) {
    @apply $(icon):nes-gap-2;
  }
}

With this config:

 postcss({
      plugins: [
        postcssFor(),
        postcssConditionals(),
        require("postcss-each-variables"),
        require("postcss-each"),
        tailwindcss(),
        autoprefixer(),
        postcssNesting(),
        postcssHexRgba(),
      ],
    }),
    inlineSvg(),

Using variables for the postcss-for packages does work without problem. EG: @apply sm:nes-gap-$(gap);

Any thoughts? Really want to use this package in combination with Tailwind.

DirkWolthuis avatar Sep 13 '21 12:09 DirkWolthuis

This should help:

https://github.com/tailwindlabs/tailwindcss/discussions/7362#discussioncomment-2132610

adamwathan avatar Feb 08 '22 11:02 adamwathan