diff --git a/README-zh_CN.md b/README-zh_CN.md index 278d34d632..bc3b09425e 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -31,7 +31,7 @@ ReactDOM.render(, mountNode); 引入样式: ```jsx -import 'antd/lib/index.css'; // or 'antd/style/index.less' +import 'antd/dist/antd.css'; // or 'antd/dist/antd.less' ``` 按需加载可通过此写法 `import DatePicker from 'antd/lib/date-picker'` 或使用插件 [babel-plugin-antd](https://github.com/ant-design/babel-plugin-antd)。 @@ -43,6 +43,13 @@ import 'antd/lib/index.css'; // or 'antd/style/index.less' > [IE8 issues](https://github.com/xcatliu/react-ie8) +## TypeScript + +```js +/// +... +``` + ## 链接 - [首页](http://ant.design/) diff --git a/README.md b/README.md index a55ef9a4e2..f510b05633 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ ReactDOM.render(, mountNode); Import style: ```jsx -import 'antd/dist/antd.css'; // or 'antd/style/index.less' +import 'antd/dist/antd.css'; // or 'antd/dist/antd.less' ``` ### Use modularized antd @@ -49,7 +49,6 @@ babel plugin config: ```jsx import { DatePicker } from 'antd'; -ReactDOM.render(, mountNode); ``` No need to import style manually. diff --git a/components/style/core/index.less b/components/style/core/index.less index 77561a0970..4901d06128 100644 --- a/components/style/core/index.less +++ b/components/style/core/index.less @@ -1,4 +1,3 @@ -@import "../themes/default"; @import "../mixins/index"; @import "base"; @import "iconfont"; diff --git a/components/style/index.less b/components/style/index.less index 2517b430c4..ce4b88c3d7 100644 --- a/components/style/index.less +++ b/components/style/index.less @@ -1 +1,2 @@ +@import "./themes/default"; @import "./core/index.less"; diff --git a/docs/react/getting-started.md b/docs/react/getting-started.md index 71d9751e0b..91d840c306 100644 --- a/docs/react/getting-started.md +++ b/docs/react/getting-started.md @@ -147,7 +147,6 @@ Ant Design React 支持所有的现代浏览器和 IE8+。 - [改变主色系](https://github.com/ant-design/antd-init/tree/master/examples/customize-antd-theme) - [使用本地字体](https://github.com/ant-design/antd-init/tree/master/examples/local-iconfont) -- [构建独立文件](https://github.com/ant-design/antd-init/tree/master/examples/build-antd-standalone) ## 小甜点 diff --git a/docs/react/introduce.md b/docs/react/introduce.md index 47e7fb35c7..c17f04e5f2 100644 --- a/docs/react/introduce.md +++ b/docs/react/introduce.md @@ -47,7 +47,7 @@ ReactDOM.render(, mountNode); 引入样式: ```jsx -import 'antd/lib/index.css'; // or 'antd/style/index.less' +import 'antd/dist/antd.css'; // or 'antd/dist/antd.less' ``` 按需加载可通过此写法 `import DatePicker from 'antd/lib/date-picker'` 或使用插件 [babel-plugin-antd](https://github.com/ant-design/babel-plugin-antd)。 diff --git a/index.js b/index.js index 3c4c7e537c..41adc16a45 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ +/* eslint no-console:0 */ // this file is not used if use https://github.com/ant-design/babel-plugin-antd import { @@ -20,7 +21,7 @@ const antd = { /* eslint no-console:0 */ if (typeof console !== 'undefined' && console.warn) { - console.warn(`you are using prebuild antd, + console.warn(`you are using prebuild antd, please use https://github.com/ant-design/babel-plugin-antd to reduce app bundle size.`); } diff --git a/package.json b/package.json index ba0f61881d..4a87cd8230 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "eslint-fix": "eslint --fix components test site scripts ./*.js --ext '.js,.jsx' && eslint-tinker ./components/*/demo/*.md", "test": "npm run lint && npm run dist && npm run jest", "jest": "jest", - "prepub": "node ./scripts/prepub", + "pre-publish":"node ./scripts/prepub", "pub": "antd-tools run pub", "beta": "antd-tools run beta", "authors": "git log --format='%aN <%aE>' | sort -u | grep -v 'users.noreply.github.com' | grep -v 'alibaba-inc.com' | grep -v 'alipay.com' | grep -v 'taobao.com' > AUTHORS.txt" diff --git a/scripts/prepub.js b/scripts/prepub.js index f00baaf111..abb37d50d3 100644 --- a/scripts/prepub.js +++ b/scripts/prepub.js @@ -1,7 +1,20 @@ #!/usr/bin/env node -/* eslint no-console:0, strict:0 */ - +/* eslint-disable */ 'use strict'; -console.log('prepub'); +// Build a entry less file to dist/antd.less +var fs = require('fs'); +var path = require('path'); +var componentsPath = path.join(process.cwd(), 'components'); +var entryLessContent = `@import "../lib/style/index.less";`; +console.log('Building a entry less file to dist/antd.less'); + +fs.readdir(componentsPath, function(err, files) { + files.forEach(function(file) { + if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) { + entryLessContent += `\n@import "../lib/${path.join(file, 'style', 'index.less')}";` + } + }); + fs.writeFileSync(path.join(process.cwd(), 'dist', 'antd.less'), entryLessContent); +});