1.0.2 • Published 4 years ago

antd.working-macro v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

antd.working-macro

A babel macro that helps you import antd's style.

Based on yesmeck/antd.macro.

Installation

$ npm install antd.working-macro --save-dev

Usage

import { Button } from 'antd.macro';

Transforms to:

import 'antd/es/button/css';
import { Button } from 'antd';

Config

Create a babel-plugin-macros config file.

// babel-plugin-macros.config.js
module.exports = {
  antd: {
    style: 'less', // default is 'css',
  },
};

What's the difference with babel-plugin-import?

  1. It's explicitly.
  2. It's antd-specific.
  3. It can be used in CRA directly without ejecting.
  4. It keeps your import statements, since webpack already has tree-shaking, it's unnecessary to import a component from a specific location.

License

MIT

1.0.2

4 years ago