babel-plugin-styled-components icon indicating copy to clipboard operation
babel-plugin-styled-components copied to clipboard

babel plugin which will change order of styled components

Open redexp opened this issue 3 years ago • 0 comments

Hello, what do think about to create new plugin or add it to current plugin which will change order of styled components from:

const First = styled.div`
  // ...
  &:hover ${Second} {
    opacity: 1;
  }
`;

const Second = styled.div`
  opacity: 0;
`;

to:

const Second = styled.div`
  opacity: 0;
`;

const First = styled.div`
  // ...
  &:hover ${Second} {
    opacity: 1;
  }
`;

So plugin will check if some component included in previous component than it must be placed before it.

I can do such plugin by my self, I just want ask do it make sense for you?

redexp avatar Feb 07 '22 10:02 redexp