2

I'd like to parse CSS-in-JS (styled-components) which is written in my tsx file into an AST so I can change the hex color into the css variable name.

For example,

const Wrapper = styled.div`
  background-color: #ffffff;
`;

to

const Wrapper = styled.div`
  background-color: white;
`;

I have researched it but only found some parser that uses .css files like postcss or cssom.

0 Answers0