postcss / postcss-nested

PostCSS plugin to unwrap nested rules like how Sass does it.
MIT License
1.15k stars 66 forks source link

Incorrect output when using Tailwindcss JIT production build #126

Closed therealgilles closed 3 years ago

therealgilles commented 3 years ago

The issue with a testcase is described here: https://github.com/tailwindlabs/tailwindcss/issues/3964

ai commented 3 years ago

I will not have on this week. Feel free to send PR.

therealgilles commented 3 years ago

How do I go about finding out where the problem lies?

The issue is related to the use how the comma, i.e. this will produce incorrect results:

    .a .b label,
    .c label {
        input[type='search'] {
            @apply bg-white;
        }
    }

but this works:

    .a .b label {
        input[type='search'] {
            @apply bg-white;
        }
    }
    .c label {
        input[type='search'] {
            @apply bg-white;
        }
    }

PS: Sorry for the weird example, I am mimicking what I have in my css file.

ai commented 3 years ago

How do I go about finding out where the problem lies?

Add test and then start to debug with console.log or IDE debugger.

Sorry, I have no better ideas for now.

therealgilles commented 3 years ago

Thank you. From my analysis, the problem lies with Tailwindcss and not postcss-nested. If I disable the tailwindcss plugin, the output looks correct. I'm going to close this issue.