ice/packages/style-import
ClarkXia c259859338
test: improve test case (#497)
* test: improve test case

* test: compat win32

* test: test case

* test: add test case

* test: add test case

* test: test case for rax-compat

* test: test case for routes

* fix: types error

* fix: to strict equal

* chore: remove unused props

* fix: types

* test: test case for run client app

* chore: remove empty router

* test: test case of run server app

* chore: remove log

* chore: do not remove file by test case

* fix: remove document dependency when run client app

* chore: lint

* chore: remove config

* fix: lint

* chore: lint warning

* fix: test case

* chore: update unplugin
2022-09-07 14:49:54 +08:00
..
src fix: transform component name (#469) 2022-08-22 14:30:44 +08:00
tests test: improve test case (#497) 2022-09-07 14:49:54 +08:00
CHANGELOG.md feat: plugin antd (#421) 2022-08-08 19:32:46 +08:00
README.md feat: plugin antd (#421) 2022-08-08 19:32:46 +08:00
package.json chore: ci workflow for release (#437) 2022-08-11 17:38:11 +08:00
tsconfig.json feat: plugin antd (#421) 2022-08-08 19:32:46 +08:00

README.md

@ice/style-import

A transform function for automatic import style.

Usage

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

transfrom(`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>); */