Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1002 Bytes

2.add-antd-support.md

File metadata and controls

53 lines (41 loc) · 1002 Bytes

添加 antd 支持

安装依赖并添加至 package.json

# antd
$ npm i -S antd

.roadhogrc

添加 antd 插件和 theme 配置

  {
    ...
+   "theme": "antd.config.js",
    "env": {
      "development": {
        "extraBabelPlugins": [
          ...
+         [ "import", { "libraryName": "antd", "style": true } ]
        ]
      },
      "production": {
        "extraBabelPlugins": [
          ...
+         [ "import", { "libraryName": "antd", "style": true } ]
        ]
      }
    },
    ...
  }

新增 antd.config.js 文件

antd 主题相关配置

相关文档参考 https://ant.design/docs/react/customize-theme-cn 不支持 es6

const path = require( 'path' );

module.exports = {
  // antd 自带图标字体本地化
  'icon-url': `"${path.relative( './~/antd/lib/style/*', './src/assets/fonts/iconfont' )}"`
};

复制字体文件到 ./src/assets/fonts/ 文件夹