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

excaped characters break selector detection with tailwind v3

Open clicktodev opened this issue 1 year ago • 3 comments

it seems it breaks with escaped characters

terminal warning:

2:3     ⚠  Nested @tailwind rules were detected, but are not supported.
Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix
Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy [undefined]

local config: "postcss-nested": "^7.0.2",

module.exports = {
  plugins: {
    'postcss-import': {},
    'postcss-nested': {},
    tailwindcss: {},
    autoprefixer: {},
  },
}

css file:

#bluesky-embed {
  @tailwind base;
  @tailwind components;
  @tailwind utilities;

  .break-word {
    word-break: break-word;
  }
}

result:

@media (min-width: 1536px) {

// not escaped
  #bluesky-embed .container {
    max-width: 1536px;
  }
}

// : is escaped 
.hover\:underline:hover {
  text-decoration-line: underline;
}

@media (min-width: 300px) {
 // : [ ] are escaped 
  .min-\[300px\]\:text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
  }
}

following https://tailwindcss.com/docs/using-with-preprocessors#nesting

https://play.tailwindcss.com/4L4HQiVNmh

image

related to https://github.com/tailwindlabs/tailwindcss/issues/14753#issuecomment-2495747574

clicktodev avatar Nov 24 '24 05:11 clicktodev

I need a PR which will fix the issue

ai avatar Nov 25 '24 21:11 ai

not sure if the issue is with this lib or postcss-selector-parser

clicktodev avatar Nov 25 '24 23:11 clicktodev

Try to do a debug to find out

ai avatar Nov 25 '24 23:11 ai