Skip to content

fix: support @layer rule#48

Open
siriwatknp wants to merge 2 commits intostyled-components:mainfrom
siriwatknp:fix/layer-rule
Open

fix: support @layer rule#48
siriwatknp wants to merge 2 commits intostyled-components:mainfrom
siriwatknp:fix/layer-rule

Conversation

@siriwatknp
Copy link
Copy Markdown

Issue

The stylis-plugin-rtl does not work when a rule has @layer as a parent.

To reproduce, add this test to the existing codebase at src/stylis-plugin-rtl.test.ts:

it("works for layer rules", () => {
    expect(
      stylis(`
        @layer default {
          .cls {
            margin-right: 32px;
            & .first-child {
              margin-right: 32px;
            }
          }
        }
      `)
    ).toMatchInlineSnapshot(
      `"@layer default{.cls{margin-left:32px;}.cls .first-child{margin-left:32px;}}"`
    );
  });

The test will fail.

Dependencies

@layer is introduced in stylis after v4.0, so need to update the dependencies and types.

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

Successfully merging this pull request may close these issues.

1 participant