diff --git a/bisheng.config.js b/bisheng.config.js index 605ff26b..4f4c265d 100644 --- a/bisheng.config.js +++ b/bisheng.config.js @@ -1,4 +1,3 @@ -const path = require('path'); module.exports = { source: [ './language', @@ -25,9 +24,12 @@ module.exports = { 'bisheng-plugin-toc?maxDepth=2', 'bisheng-plugin-react?lang=__react', 'bisheng-plugin-antd', - //'./src/bisheng-plugin-antm', ], webpackConfig(config) { + config.babel.plugins.push(['import', { + libraryName: 'antd', + style: true, + }]); config.resolve.alias = { 'react-router': 'react-router/umd/ReactRouter', }; diff --git a/components/animate/demo/appear.md b/components/animate/demo/appear.md index 531d12c7..a04a79ea 100644 --- a/components/animate/demo/appear.md +++ b/components/animate/demo/appear.md @@ -7,7 +7,7 @@ title: 开始的进场 ```jsx import Animate from 'rc-animate'; -import Button from 'antd/lib/button'; +import { Button } from 'antd'; class Test extends React.Component{ constructor() { super(...arguments); diff --git a/components/animate/demo/remove.md b/components/animate/demo/remove.md index c64c4cc2..8b245f5a 100644 --- a/components/animate/demo/remove.md +++ b/components/animate/demo/remove.md @@ -7,7 +7,7 @@ title: 删除子级 ```jsx import Animate from 'rc-animate'; -import Button from 'antd/lib/button'; +import { Button } from 'antd'; class Test extends React.Component{ constructor() { super(...arguments); diff --git a/components/animate/demo/simple.md b/components/animate/demo/simple.md index 33fd3687..6e220311 100644 --- a/components/animate/demo/simple.md +++ b/components/animate/demo/simple.md @@ -7,7 +7,7 @@ title: 简单的例子 ```jsx import Animate from 'rc-animate'; -import Button from 'antd/lib/button'; +import { Button } from 'antd'; const Div = (props) => { const childrenProps = { ...props }; delete childrenProps.show; diff --git a/exhibition/demo/detail-switch.md b/exhibition/demo/detail-switch.md index bccf69e9..860e4677 100644 --- a/exhibition/demo/detail-switch.md +++ b/exhibition/demo/detail-switch.md @@ -15,7 +15,7 @@ image: https://zos.alipayobjects.com/rmsportal/cvLbMZkjkNvqbVF.png import BannerAnim from 'rc-banner-anim'; import QueueAnim from 'rc-queue-anim'; import { TweenOneGroup } from 'rc-tween-one'; -import Icon from 'antd/lib/icon'; +import { Icon } from 'antd'; const Element = BannerAnim.Element; diff --git a/exhibition/demo/list-sort.md b/exhibition/demo/list-sort.md index f8b65df9..87bad33c 100644 --- a/exhibition/demo/list-sort.md +++ b/exhibition/demo/list-sort.md @@ -12,7 +12,7 @@ image: https://zos.alipayobjects.com/rmsportal/BgYxbsXLrUfkkRT.png ListSort 组件地址: [地址](https://github.com/ant-design/ant-motion/blob/master/src/edit/template/components/ListSort.jsx) ```jsx -import Icon from 'antd/lib/icon'; +import { Icon } from 'antd'; import ListSort from '../../src/edit/template/components/ListSort'; const dataArray = [ diff --git a/exhibition/demo/logo-gather-anim.md b/exhibition/demo/logo-gather-anim.md index 95adb7f3..0829e186 100644 --- a/exhibition/demo/logo-gather-anim.md +++ b/exhibition/demo/logo-gather-anim.md @@ -19,12 +19,7 @@ image: https://zos.alipayobjects.com/rmsportal/YsRZqQwpiAVgWrX.png ```jsx import TweenOne, { TweenOneGroup } from 'rc-tween-one'; import ticker from 'rc-tween-one/lib/ticker'; -import Input from 'antd/lib/input'; -import Button from 'antd/lib/button'; -import InputNumber from 'antd/lib/input-number'; -import Radio from 'antd/lib/radio'; -import 'antd/lib/input-number/style/index.less'; -import 'antd/lib/radio/style/index.less'; +import { Input, Button, InputNumber, Radio } from 'antd'; const RadioGroup = Radio.Group; diff --git a/exhibition/demo/pic-details-anim.md b/exhibition/demo/pic-details-anim.md index 0ea62823..e99635c6 100644 --- a/exhibition/demo/pic-details-anim.md +++ b/exhibition/demo/pic-details-anim.md @@ -14,7 +14,7 @@ image: https://zos.alipayobjects.com/rmsportal/RJoNICBzRCkOsMv.png ```jsx import QueueAnim from 'rc-queue-anim'; import TweenOne, { TweenOneGroup } from 'rc-tween-one'; -import Icon from 'antd/lib/icon'; +import { Icon } from 'antd'; const textData = { content: 'Taiwan called motorcycle, motor bike [1] or a motorcycle,' + diff --git a/exhibition/demo/table-enter-leave.md b/exhibition/demo/table-enter-leave.md index 0be034a5..995ec587 100644 --- a/exhibition/demo/table-enter-leave.md +++ b/exhibition/demo/table-enter-leave.md @@ -16,13 +16,9 @@ image: https://zos.alipayobjects.com/rmsportal/wJDizWNyyxVhULT.png 此效果为设计语言里的对象增加与对象删除的实现。[查看视频演示](/language/interact) ```jsx -import Table from 'antd/lib/table'; +import { Table, Button } from 'antd'; import QueueAnim from 'rc-queue-anim'; import { TweenOneGroup } from 'rc-tween-one'; -import Button from 'antd/lib/button'; -import 'antd/lib/table/style/index.less'; -import 'antd/lib/spin/style/index.less'; -import 'antd/lib/pagination/style/index.less'; class TableEnterLeave extends React.Component { static propTypes = { diff --git a/exhibition/js/detail-swich.jsx b/exhibition/js/detail-swich.jsx index 932f43e8..0de8158b 100644 --- a/exhibition/js/detail-swich.jsx +++ b/exhibition/js/detail-swich.jsx @@ -2,7 +2,7 @@ import React from 'react'; import BannerAnim from 'rc-banner-anim'; import QueueAnim from 'rc-queue-anim'; import { TweenOneGroup } from 'rc-tween-one'; -import Icon from 'antd/lib/icon'; +import { Icon } from 'antd'; import './detail-swich.css'; const Element = BannerAnim.Element; diff --git a/exhibition/js/list-sort.jsx b/exhibition/js/list-sort.jsx index 8d6acc1f..cb7b9589 100644 --- a/exhibition/js/list-sort.jsx +++ b/exhibition/js/list-sort.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import Icon from 'antd/lib/icon'; +import { Icon } from 'antd'; import ListSort from '../../src/edit/template/components/ListSort'; import './list-sort.css'; diff --git a/exhibition/js/logo-gather-anim.jsx b/exhibition/js/logo-gather-anim.jsx index 4289f100..81516ce8 100644 --- a/exhibition/js/logo-gather-anim.jsx +++ b/exhibition/js/logo-gather-anim.jsx @@ -2,12 +2,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import TweenOne, { TweenOneGroup } from 'rc-tween-one'; import ticker from 'rc-tween-one/lib/ticker'; -import Input from 'antd/lib/input'; -import Button from 'antd/lib/button'; -import InputNumber from 'antd/lib/input-number'; -import Radio from 'antd/lib/radio'; -import 'antd/lib/input-number/style/index.less'; -import 'antd/lib/radio/style/index.less'; +import { Input, Button, InputNumber, Radio } from 'antd'; import './logo-gather-anim.css'; const RadioGroup = Radio.Group; diff --git a/exhibition/js/pic-details-anim.jsx b/exhibition/js/pic-details-anim.jsx index 33abbec0..f44b04f7 100644 --- a/exhibition/js/pic-details-anim.jsx +++ b/exhibition/js/pic-details-anim.jsx @@ -1,7 +1,7 @@ import React from 'react'; import QueueAnim from 'rc-queue-anim'; import TweenOne, { TweenOneGroup } from 'rc-tween-one'; -import Icon from 'antd/lib/icon'; +import { Icon } from 'antd'; import './pic-details-anim.css'; const textData = { diff --git a/exhibition/js/table-enter-leave.jsx b/exhibition/js/table-enter-leave.jsx index 5aea52e3..bb34f6cd 100644 --- a/exhibition/js/table-enter-leave.jsx +++ b/exhibition/js/table-enter-leave.jsx @@ -1,11 +1,7 @@ import React from 'react'; -import Table from 'antd/lib/table'; +import { Table, Button } from 'antd'; import QueueAnim from 'rc-queue-anim'; import { TweenOneGroup } from 'rc-tween-one'; -import Button from 'antd/lib/button'; -import 'antd/lib/table/style/index.less'; -import 'antd/lib/spin/style/index.less'; -import 'antd/lib/pagination/style/index.less'; import './table-enter-leave.css'; export default class TableEnterLeave extends React.Component { diff --git a/package.json b/package.json index 40059669..bbc2b2c1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "ant-motion", "version": "1.4.0", "dependencies": { - "antd": "~2.5.0", + "antd": "~2.6.0", "autoresponsive-react": "1.1.x", "deepcopy": "^0.6.3", "file-saver": "^1.3.2", @@ -27,16 +27,15 @@ "tween-functions": "^1.2.0" }, "devDependencies": { - "bluebird": "^3.4.0", - "pre-commit": "1.x", "babel-eslint": "^7.1.1", "babel-plugin-antd": "~0.5.1", - "prismjs": "^1.5.1", + "babel-plugin-import": "^1.1.0", "bisheng": "^0.13.0", "bisheng-plugin-antd": "~0.3.0", "bisheng-plugin-description": "^0.1.1", "bisheng-plugin-react": "^0.2.0", "bisheng-plugin-toc": "^0.3.0", + "bluebird": "^3.4.0", "dora-plugin-upload": "^0.3.1", "eslint": "^3.8.0", "eslint-config-airbnb": "latest", @@ -45,7 +44,9 @@ "eslint-plugin-jsx-a11y": "^2.0.1", "eslint-plugin-markdown": "*", "eslint-plugin-react": "^6.1.2", - "eslint-tinker": "^0.4.0" + "eslint-tinker": "^0.4.0", + "pre-commit": "1.x", + "prismjs": "^1.5.1" }, "pre-commit": [ "lint" @@ -60,5 +61,6 @@ "demolint": "RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'", "eslint-fix": "eslint --fix ./src ./exhibition --ext '.js,.jsx'", "test": "echo \"Error: no test specified\" && exit 1" - } + }, + "theme": "./theme.js" } diff --git a/src/edit/static/ant-d.less b/src/edit/static/ant-d.less deleted file mode 100644 index 6d3e8052..00000000 --- a/src/edit/static/ant-d.less +++ /dev/null @@ -1,14 +0,0 @@ -@import './custom.less'; -@import "~antd/lib/style/core/index.less"; -@import "~antd/lib/button/style/index.less"; -@import "~antd/lib/menu/style/index.less"; -@import "~antd/lib/input/style/index.less"; -@import "~antd/lib/tabs/style/index.less"; -@import "~antd/lib/modal/style/index.less"; -@import "~antd/lib/checkbox/style/index.less"; -@import "~antd/lib/tooltip/style/index.less"; -@import "~antd/lib/select/style/index.less"; -@import "~antd/lib/message/style/index.less"; -@import "~antd/lib/alert/style/index.less"; -@import "~antd/lib/auto-complete/style/index.less"; - diff --git a/src/edit/static/style.js b/src/edit/static/style.js index b3d8f17f..b7147ef6 100644 --- a/src/edit/static/style.js +++ b/src/edit/static/style.js @@ -6,5 +6,4 @@ import './list-view.less'; import './other-view.less'; import './preview.less'; import './edit-state.less'; -import './ant-d.less'; diff --git a/src/edit/template/components/ContentController.jsx b/src/edit/template/components/ContentController.jsx index 71fb3fad..6e9e358f 100644 --- a/src/edit/template/components/ContentController.jsx +++ b/src/edit/template/components/ContentController.jsx @@ -1,6 +1,5 @@ import React, { PropTypes } from 'react'; -import Tabs from 'antd/lib/tabs'; -import Tooltip from 'antd/lib/tooltip'; +import { Tabs, Tooltip } from 'antd'; import ListView from './ListView'; import EditView from './EditView'; import OtherView from './OtherView'; diff --git a/src/edit/template/components/EditView.jsx b/src/edit/template/components/EditView.jsx index b597026a..a334b343 100644 --- a/src/edit/template/components/EditView.jsx +++ b/src/edit/template/components/EditView.jsx @@ -1,11 +1,6 @@ import React, { PropTypes } from 'react'; import ReactDOM from 'react-dom'; -import Icon from 'antd/lib/icon'; -import Tooltip from 'antd/lib/tooltip'; -import Button from 'antd/lib/button'; -import Input from 'antd/lib/input'; -import InputNumber from 'antd/lib/input-number'; -import Select from 'antd/lib/select'; +import { Icon, Tooltip, Button, Input, InputNumber, Select } from 'antd'; import { TweenOneGroup } from 'rc-tween-one'; import SketchPicker from 'react-color'; import deepCopy from 'deepcopy'; diff --git a/src/edit/template/components/ListView.jsx b/src/edit/template/components/ListView.jsx index 2fd9c6c2..77babf0d 100644 --- a/src/edit/template/components/ListView.jsx +++ b/src/edit/template/components/ListView.jsx @@ -1,9 +1,5 @@ import React, { PropTypes } from 'react'; -import Icon from 'antd/lib/icon'; -import Modal from 'antd/lib/modal'; -import Alert from 'antd/lib/alert'; -import Checkbox from 'antd/lib/checkbox'; -import InputNumber from 'antd/lib/input-number'; +import { Icon, Modal, Alert, Checkbox, InputNumber } from 'antd'; import { TweenOneGroup } from 'rc-tween-one'; import ListSort from './ListSort'; import webData from './../template.config'; diff --git a/src/edit/template/components/NavController.jsx b/src/edit/template/components/NavController.jsx index a4ab6a72..6314afb2 100644 --- a/src/edit/template/components/NavController.jsx +++ b/src/edit/template/components/NavController.jsx @@ -1,9 +1,5 @@ import React, { PropTypes } from 'react'; -import Button from 'antd/lib/button'; -import Icon from 'antd/lib/icon'; -import Modal from 'antd/lib/modal'; -// import Tooltip from 'antd/lib/tooltip'; -import message from 'antd/lib/message'; +import { Button, Icon, Modal, message } from 'antd'; import CopyToClipboard from 'react-copy-to-clipboard'; import saveJsZip from './saveJsZip'; diff --git a/src/edit/template/components/OtherView.jsx b/src/edit/template/components/OtherView.jsx index c41e362b..9db47fc8 100644 --- a/src/edit/template/components/OtherView.jsx +++ b/src/edit/template/components/OtherView.jsx @@ -1,5 +1,5 @@ import React, { PropTypes } from 'react'; -import Checkbox from 'antd/lib/checkbox'; +import { Checkbox } from 'antd'; import webData from './../template.config'; export default class OtherView extends React.Component { diff --git a/src/templates/static/ant-d.less b/src/templates/static/ant-d.less deleted file mode 100644 index 53bedd57..00000000 --- a/src/templates/static/ant-d.less +++ /dev/null @@ -1,6 +0,0 @@ -@import "custom.less"; -@import "~antd/lib/style/core/index.less"; -@import "~antd/lib/button/style/index.less"; -@import "~antd/lib/menu/style/index.less"; -@import "~antd/lib/input/style/index.less"; -@import "~antd/lib/modal/style/index.less"; diff --git a/src/templates/static/common.less b/src/templates/static/common.less index 32ef64eb..6f97dd87 100644 --- a/src/templates/static/common.less +++ b/src/templates/static/common.less @@ -1,4 +1,3 @@ -@import 'ant-d'; @import '../../theme/static/global'; html, body { diff --git a/src/templates/static/custom.less b/src/templates/static/custom.less index 72380b95..7e783c79 100644 --- a/src/templates/static/custom.less +++ b/src/templates/static/custom.less @@ -1,5 +1,4 @@ @import "~antd/lib/style/themes/default.less"; -@primary-color: #019BF0; @link-color : #019BF0; @link-hover-color : tint(@link-color, 20%); @@ -24,6 +23,7 @@ @template-text-color: #CCC; @template-text-title-color: #BCBCBC; @template-text-color-light: #FFF; +@template-footer-text-color: #666; @animate-duration: .45s; diff --git a/src/templates/static/lessToString.jsx b/src/templates/static/lessToString.jsx index e9c39e83..3180bfa7 100644 --- a/src/templates/static/lessToString.jsx +++ b/src/templates/static/lessToString.jsx @@ -2,7 +2,6 @@ let point = require('!raw!./point.less'); point = point.replace('../../../static/custom.less', './custom.less'); -const antD = require('!raw!./ant-d.less'); const global = require('!raw!../../theme/static/global.less'); let common = require('!raw!./common.less'); @@ -12,7 +11,6 @@ const custom = require('!raw!./custom.less'); const content = require('!raw!./content.less'); export default { - 'ant-d': antD, global, common, custom, diff --git a/src/templates/template/element/Content0/index.jsx b/src/templates/template/element/Content0/index.jsx index deae905a..f3dc35aa 100644 --- a/src/templates/template/element/Content0/index.jsx +++ b/src/templates/template/element/Content0/index.jsx @@ -1,8 +1,7 @@ import React, { PropTypes } from 'react'; -import Button from 'antd/lib/button'; +import { Button, Icon } from 'antd'; import QueueAnim from 'rc-queue-anim'; import TweenOne from 'rc-tween-one'; -import Icon from 'antd/lib/icon'; import OverPack from 'rc-scroll-anim/lib/ScrollOverPack'; import './index.less'; diff --git a/src/templates/template/element/Content0/index.text b/src/templates/template/element/Content0/index.text index f2d7a663..018acfc1 100644 --- a/src/templates/template/element/Content0/index.text +++ b/src/templates/template/element/Content0/index.text @@ -1,8 +1,7 @@ import React, { PropTypes } from 'react'; -import Button from 'antd/lib/button'; +import { Button, Icon } from 'antd'; import QueueAnim from 'rc-queue-anim'; import TweenOne from 'rc-tween-one'; -import Icon from 'antd/lib/icon'; import OverPack from 'rc-scroll-anim/lib/ScrollOverPack'; class Content extends React.Component { diff --git a/src/templates/template/element/Content1/index.jsx b/src/templates/template/element/Content1/index.jsx index d3f128ff..c72515cc 100644 --- a/src/templates/template/element/Content1/index.jsx +++ b/src/templates/template/element/Content1/index.jsx @@ -1,9 +1,8 @@ import React, { PropTypes } from 'react'; -import Button from 'antd/lib/button'; +import { Button, Icon } from 'antd'; import QueueAnim from 'rc-queue-anim'; import TweenOne from 'rc-tween-one'; import BannerAnim, { Element } from 'rc-banner-anim'; -import Icon from 'antd/lib/icon'; import 'rc-banner-anim/assets/index.css'; import OverPack from 'rc-scroll-anim/lib/ScrollOverPack'; import './index.less'; diff --git a/src/templates/template/element/Content1/index.text b/src/templates/template/element/Content1/index.text index 43c3a229..11fb6ee3 100644 --- a/src/templates/template/element/Content1/index.text +++ b/src/templates/template/element/Content1/index.text @@ -1,9 +1,8 @@ import React, { PropTypes } from 'react'; -import Button from 'antd/lib/button'; +import { Button, Icon } from 'antd'; import QueueAnim from 'rc-queue-anim'; import TweenOne from 'rc-tween-one'; import BannerAnim, { Element } from 'rc-banner-anim'; -import Icon from 'antd/lib/icon'; import 'rc-banner-anim/assets/index.css'; import OverPack from 'rc-scroll-anim/lib/ScrollOverPack'; diff --git a/src/templates/template/element/Content8/index.jsx b/src/templates/template/element/Content8/index.jsx index 6053fb69..5f470932 100644 --- a/src/templates/template/element/Content8/index.jsx +++ b/src/templates/template/element/Content8/index.jsx @@ -1,8 +1,7 @@ import React from 'react'; import TweenOne from 'rc-tween-one'; import OverPack from 'rc-scroll-anim/lib/ScrollOverPack'; -import Tabs from 'antd/lib/tabs'; -import 'antd/lib/tabs/style'; +import { Tabs } from 'antd'; import '../../../static/content.less'; import './index.less'; diff --git a/src/templates/template/element/Content8/index.text b/src/templates/template/element/Content8/index.text index d58e2791..941ff6b9 100644 --- a/src/templates/template/element/Content8/index.text +++ b/src/templates/template/element/Content8/index.text @@ -1,8 +1,7 @@ import React from 'react'; import TweenOne from 'rc-tween-one'; import OverPack from 'rc-scroll-anim/lib/ScrollOverPack'; -import Tabs from 'antd/lib/tabs'; -import 'antd/lib/tabs/style'; +import { Tabs } from 'antd'; const TabPane = Tabs.TabPane; diff --git a/src/templates/template/element/Footer0/index.less b/src/templates/template/element/Footer0/index.less index 57bd8edc..221cd578 100644 --- a/src/templates/template/element/Footer0/index.less +++ b/src/templates/template/element/Footer0/index.less @@ -5,6 +5,7 @@ background-color: @template-bg-color; text-align: center; height: 80px; + color: @template-footer-text-color; span{ display: inline-block; line-height: 60px; diff --git a/src/templates/template/element/Footer1/index.less b/src/templates/template/element/Footer1/index.less index 7c09c607..de19f160 100644 --- a/src/templates/template/element/Footer1/index.less +++ b/src/templates/template/element/Footer1/index.less @@ -6,6 +6,7 @@ height: 400px; overflow: hidden; position: relative; + color: @template-footer-text-color; & > ul { width: 95%; max-width: 1200px; diff --git a/src/templates/template/element/Nav0/index.jsx b/src/templates/template/element/Nav0/index.jsx index cef218f1..ca93f080 100644 --- a/src/templates/template/element/Nav0/index.jsx +++ b/src/templates/template/element/Nav0/index.jsx @@ -1,6 +1,6 @@ import React, { PropTypes } from 'react'; import TweenOne from 'rc-tween-one'; -import Menu from 'antd/lib/menu'; +import { Menu } from 'antd'; import './index.less'; const Item = Menu.Item; diff --git a/src/templates/template/element/Nav0/index.text b/src/templates/template/element/Nav0/index.text index 95c4f515..19e06f08 100644 --- a/src/templates/template/element/Nav0/index.text +++ b/src/templates/template/element/Nav0/index.text @@ -1,6 +1,6 @@ import React, { PropTypes } from 'react'; import TweenOne from 'rc-tween-one'; -import Menu from 'antd/lib/menu'; +import { Menu } from 'antd'; const Item = Menu.Item; diff --git a/src/templates/template/element/Nav1/index.jsx b/src/templates/template/element/Nav1/index.jsx index 4a761b4b..b4b59786 100644 --- a/src/templates/template/element/Nav1/index.jsx +++ b/src/templates/template/element/Nav1/index.jsx @@ -1,7 +1,6 @@ import React, { PropTypes } from 'react'; import TweenOne from 'rc-tween-one'; -import Menu from 'antd/lib/menu'; -import Icon from 'antd/lib/icon'; +import { Menu, Icon } from 'antd'; import './index.less'; const Item = Menu.Item; diff --git a/src/templates/template/element/Nav1/index.text b/src/templates/template/element/Nav1/index.text index 492109ca..f7ec2779 100644 --- a/src/templates/template/element/Nav1/index.text +++ b/src/templates/template/element/Nav1/index.text @@ -1,7 +1,6 @@ import React, { PropTypes } from 'react'; import TweenOne from 'rc-tween-one'; -import Menu from 'antd/lib/menu'; -import Icon from 'antd/lib/icon'; +import { Menu, Icon } from 'antd'; const Item = Menu.Item; diff --git a/src/templates/template/other/documentation.text b/src/templates/template/other/documentation.text index 0e437116..aefcc155 100644 --- a/src/templates/template/other/documentation.text +++ b/src/templates/template/other/documentation.text @@ -6,7 +6,7 @@ 3. 修改 router.js 里的 IndexPage 的路径: import IndexPage from './routes/Home'; -4. 如果用的是 antd 的脚手 dva-cli (https://github.com/dvajs/dva-cli) 需要注意加上 /antMotion_style\.less/ 的. +4. 如果用的是 antd 的脚手 dva-cli (https://github.com/dvajs/dva-cli) 需要注意在 webpack.config.js 里加上 /antMotion_style\.less/ 的. // Parse all less files as css module. webpackConfig.module.loaders.forEach(function (loader, index) { if (typeof loader.test === 'function' && loader.test.toString().indexOf('\\.less$') > -1) { @@ -34,7 +34,18 @@ "rc-tween-one": "~0.11.11", "rc-banner-anim": "~0.5.4", // 如果用的是多屏滑动型的 banner,加上这条。 -以上具体版本按最新的来修改。 +6. 按需加载 antd, package.json 里的 devDependencies 加上: +"babel-plugin-import": "^1.1.0", -6. 将当前文件删除。 +5 与 6 的具体版本按最新的来修改。 + +7. 运用 "babel-plugin-import" 滤境,在 webpack.config.js 里加上; + webpackConfig.babel.plugins.push(['import', { + libraryName: 'antd', + style: true, + }]); + +8. 配置自定义皮服,参考 https://ant.design/docs/react/customize-theme-cn#1)-package.theme(推荐); + +9. 将当前文件删除。 diff --git a/src/theme/static/ant-d.less b/src/theme/static/ant-d.less deleted file mode 100644 index 4fb3a8ad..00000000 --- a/src/theme/static/ant-d.less +++ /dev/null @@ -1,14 +0,0 @@ -@import "./custom.less"; -@import "~antd/lib/style/core/index.less"; -@import "~antd/lib/steps/style/index.less"; -@import "~antd/lib/button/style/index.less"; -@import "~antd/lib/modal/style/index.less"; -@import "~antd/lib/grid/style/index.less"; -@import "~antd/lib/tag/style/index.less"; -@import "~antd/lib/message/style/index.less"; -@import "~antd/lib/menu/style/index.less"; -@import "~antd/lib/checkbox/style/index.less"; -@import "~antd/lib/tooltip/style/index.less"; -@import "~antd/lib/input/style/index.less"; -@import "~antd/lib/affix/style/index.less"; - diff --git a/src/theme/static/custom.less b/src/theme/static/custom.less index a3159b69..bc00cbbc 100644 --- a/src/theme/static/custom.less +++ b/src/theme/static/custom.less @@ -1,8 +1,5 @@ @import "~antd/lib/style/themes/default.less"; -@primary-color: #019BF0; - -@text-color: #666; @text-color-home: #9FB0C7; // @text-color-home-banner: #3761b5; @text-color-light: #fff; diff --git a/src/theme/static/style.js b/src/theme/static/style.js index 3405cbb1..0cccb18f 100644 --- a/src/theme/static/style.js +++ b/src/theme/static/style.js @@ -1,4 +1,3 @@ -import './ant-d.less'; import './global.less'; import './common.less'; import './highlight.less'; diff --git a/src/theme/template/Content/DemoItem.jsx b/src/theme/template/Content/DemoItem.jsx index e308a241..93d118b2 100644 --- a/src/theme/template/Content/DemoItem.jsx +++ b/src/theme/template/Content/DemoItem.jsx @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react'; import ReactDOM from 'react-dom'; import TweenOne from 'rc-tween-one'; -import Icon from 'antd/lib/icon'; +import { Icon } from 'antd'; class Item extends React.Component { constructor(props) { diff --git a/src/theme/template/Content/Page.jsx b/src/theme/template/Content/Page.jsx index 11f984d3..2e3af542 100644 --- a/src/theme/template/Content/Page.jsx +++ b/src/theme/template/Content/Page.jsx @@ -2,7 +2,7 @@ import React, { PropTypes } from 'react'; import { TweenOneGroup } from 'rc-tween-one'; import QueueAnim from 'rc-queue-anim'; import { Link } from 'react-router'; -import Affix from 'antd/lib/affix'; +import { Affix } from 'antd'; import nav from '../Layout/nav'; import { scrollClick } from '../utils'; diff --git a/theme.js b/theme.js new file mode 100644 index 00000000..aac8bd79 --- /dev/null +++ b/theme.js @@ -0,0 +1,6 @@ +module.exports = () => { + return { + '@primary-color': '#019BF0', + '@text-color': '#666', + }; +}; diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 34e10dd6..00000000 --- a/webpack.config.js +++ /dev/null @@ -1,19 +0,0 @@ -const webpack = require('atool-build/lib/webpack'); -const fs = require('fs'); -const path = require('path'); -const glob = require('glob'); - -module.exports = function (webpackConfig) { - webpackConfig.babel.plugins.push('transform-runtime'); - - // Load src/entries/*.js as entry automatically. - const files = glob.sync('./src/entries/*.js'); - const newEntries = files.reduce(function(memo, file) { - const name = path.basename(file, '.js'); - memo[name] = file; - return memo; - }, {}); - webpackConfig.entry = Object.assign({}, webpackConfig.entry, newEntries); - - return webpackConfig; -};