Coder Social home page Coder Social logo

antd.macro's Introduction

antd.macro

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

Installation

$ npm install antd.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

antd.macro's People

Contributors

yesmeck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

malven

antd.macro's Issues

Components with `-` in the name fails to load

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
When trying to import any of these components:

  • DatePicker
  • TimePicker
  • AutoComplete
  • ConfigProvider
  • InputNumber
  • PageHeader
  • TreeSelect

the macro fails because the path to the component includes a - character.

What is the expected behavior?
The macro should import the component with the correct path.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.