babel-plugin-antd

Modular antd build plugin for babel.

babel-plugin-antd is renamed to babel-plugin-import
Last updated 9 years ago by sorrycc .
MIT · Original npm
$ cnpm install babel-plugin-antd 
SYNC missed versions from official npm registry.

babel-plugin-antd

NPM version Build Status


CHANGELOG

0.5.1

  • #50 - Support both antd and antd-mobile
  • #51 - Support export import

Example

Converts

import { Button } from 'antd';

ReactDOM.render(<div>
  <Button>xxxx</Button>
</div>);

(roughly) to

var _button = require('antd/lib/button');

ReactDOM.render(<div>
  <_button>xxxx</_button>
</div>);

Usage

npm install babel-plugin-antd --save-dev

Via .babelrc or babel-loader.

{
  "plugins": [["antd", options]]
}

options

options can be object.

{
  style: true,
  libraryDirectory: "component",  // default: lib
  libraryName: "antd",            // default: antd
}

options can be an array.

For Example:

[
  {
    libraryName: "antd",
    libraryDirectory: "lib",   // default: lib
    style: true,
  },
  {
    libraryName: "antd-mobile",
    libraryDirectory: "component",
  },
]

style

  • ["antd", [{ "libraryName": "antd" }]]: import js modularly
  • ["antd", [{ "libraryName": "antd", "style": true }]]: import js and css modularly (less source files)
  • ["antd", [{ "libraryName": "antd", "style": "css" }]]: import style css modularly (css built files)

Current Tags

  • 0.4.0                                ...           latest (9 years ago)

1 Versions

  • 0.4.0 [deprecated]           ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (13)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org