ice/packages/style-import
ClarkXia 7ae6af361d
chore: update versions (#6820)
2024-03-07 11:26:12 +08:00
..
src Feat: optimize theme package injection (#6822) 2024-03-07 10:04:11 +08:00
tests Feat: optimize theme package injection (#6822) 2024-03-07 10:04:11 +08:00
CHANGELOG.md chore: update versions (#6820) 2024-03-07 11:26:12 +08:00
README.md docs: transform function typo (#6575) 2023-10-12 11:40:28 +08:00
package.json chore: update versions (#6820) 2024-03-07 11:26:12 +08:00
tsconfig.json feat: plugin antd (#421) 2022-11-15 10:19:56 +08:00

README.md

@ice/style-import

A transform function for automatic import style.

Usage

import transform from '@ice/style-import';

transform(`import { Button } from 'antd';
ReactDOM.render(<Button>xxxx</Button>);`, [{
  libraryName: 'antd',
  style: (importSpecifiers) =>
    importSpecifiers.map(specifier =>
      `import 'antd/es/${specifier}/style'`).join('\n'),
}]);

// the code will turn out as blew:
/* 
import { Button } from 'Button';
import 'antd/es/Button/style';
ReactDOM.render(<Button>xxxx</Button>); */