compiled icon indicating copy to clipboard operation
compiled copied to clipboard

Class names local variable usage results in being unable to statically extract value

Open itsdouges opened this issue 5 years ago • 0 comments

found a edge case that isnt statically extracted

      import { ClassNames } from '@compiled/react';

      const ListItem = () => (
        <ClassNames>
          {({ css }) => {
            const color = 'blue';
            return <div className={css({ fontSize: '20px', color })}>hello, world!</div>;
            // color ends up being a css variable
          }}
        </ClassNames>
      );

Originally posted by @madou in https://github.com/atlassian-labs/compiled/pull/361#discussion_r526814407

itsdouges avatar Nov 19 '20 12:11 itsdouges