1.0.3 • Published 6 years ago

react-app-rewire-antd v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

react-app-rewire-antd

Standard - JavaScript Style Guide Dependency Status DevDependency Status NPM Downloads Travis Build Status

Load antd into your create-react-app app via react-app-rewired.

Install

$ npm install react-app-rewire-antd

Usage

First, edit config-overrides.js:

/* config-overrides.js */
const rewireAntd = require('react-app-rewire-antd')

module.exports = function override(config, env) {

  // ...

  config = rewireAntd({
    '@primary-color': 'rgb(97,43,189)'
  })(config, env)

  // ...

  return config
}

Then, use antd as normal module. antd's components related JS and CSS will be imported on demand:

import React, { Component } from 'react';
import { Button } from 'antd'; // only import Button related JS and CSS

class App extends Component {
  render() {
    return (
      <div>
        <Button type="primary">Button</Button>
      </div>
    );
  }
}

export default App;

That's it !

API

rewireAntd(options)

  • options

How it works

Thanks to the power of following packages:

  • react-app-rewired
  • react-app-rewire-less
  • babel-plugin-import

And following packages:

And official ant-design docs: