mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
Add entry less file and update document (#1534)
* Add entry less file and update document * fix pre-publish script
This commit is contained in:
parent
36af97c20b
commit
205e76aa73
@ -31,7 +31,7 @@ ReactDOM.render(<DatePicker />, mountNode);
|
|||||||
引入样式:
|
引入样式:
|
||||||
|
|
||||||
```jsx
|
```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)。
|
按需加载可通过此写法 `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)
|
> [IE8 issues](https://github.com/xcatliu/react-ie8)
|
||||||
|
|
||||||
|
## TypeScript
|
||||||
|
|
||||||
|
```js
|
||||||
|
///<reference path='./node_modules/antd/type-definitions/antd.d.ts'/>
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
## 链接
|
## 链接
|
||||||
|
|
||||||
- [首页](http://ant.design/)
|
- [首页](http://ant.design/)
|
||||||
|
@ -32,7 +32,7 @@ ReactDOM.render(<DatePicker />, mountNode);
|
|||||||
Import style:
|
Import style:
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
import 'antd/dist/antd.css'; // or 'antd/style/index.less'
|
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Use modularized antd
|
### Use modularized antd
|
||||||
@ -49,7 +49,6 @@ babel plugin config:
|
|||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
import { DatePicker } from 'antd';
|
import { DatePicker } from 'antd';
|
||||||
ReactDOM.render(<DatePicker />, mountNode);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
No need to import style manually.
|
No need to import style manually.
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
@import "../themes/default";
|
|
||||||
@import "../mixins/index";
|
@import "../mixins/index";
|
||||||
@import "base";
|
@import "base";
|
||||||
@import "iconfont";
|
@import "iconfont";
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
@import "./themes/default";
|
||||||
@import "./core/index.less";
|
@import "./core/index.less";
|
||||||
|
@ -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/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/local-iconfont)
|
||||||
- [构建独立文件](https://github.com/ant-design/antd-init/tree/master/examples/build-antd-standalone)
|
|
||||||
|
|
||||||
## 小甜点
|
## 小甜点
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ ReactDOM.render(<DatePicker />, mountNode);
|
|||||||
引入样式:
|
引入样式:
|
||||||
|
|
||||||
```jsx
|
```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)。
|
按需加载可通过此写法 `import DatePicker from 'antd/lib/date-picker'` 或使用插件 [babel-plugin-antd](https://github.com/ant-design/babel-plugin-antd)。
|
||||||
|
3
index.js
3
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
|
// this file is not used if use https://github.com/ant-design/babel-plugin-antd
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -20,7 +21,7 @@ const antd = {
|
|||||||
/* eslint no-console:0 */
|
/* eslint no-console:0 */
|
||||||
|
|
||||||
if (typeof console !== 'undefined' && console.warn) {
|
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.`);
|
please use https://github.com/ant-design/babel-plugin-antd to reduce app bundle size.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
"eslint-fix": "eslint --fix components test site scripts ./*.js --ext '.js,.jsx' && eslint-tinker ./components/*/demo/*.md",
|
"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",
|
"test": "npm run lint && npm run dist && npm run jest",
|
||||||
"jest": "jest",
|
"jest": "jest",
|
||||||
"prepub": "node ./scripts/prepub",
|
"pre-publish":"node ./scripts/prepub",
|
||||||
"pub": "antd-tools run pub",
|
"pub": "antd-tools run pub",
|
||||||
"beta": "antd-tools run beta",
|
"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"
|
"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"
|
||||||
|
@ -1,7 +1,20 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
/* eslint no-console:0, strict:0 */
|
/* eslint-disable */
|
||||||
|
|
||||||
'use strict';
|
'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);
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user