fix: rename antd-dark to dark

This commit is contained in:
ycjcl868 2019-12-04 23:13:59 +08:00
parent b6f2d73a56
commit e1d850374a
4 changed files with 16 additions and 16 deletions

View File

@ -60,16 +60,16 @@ function finalizeDist() {
// eslint-disable-next-line
console.log('Built a entry less file to dist/antd.less');
// Build less entry file: dist/antd-dark.less
// Build less entry file: dist/dark.less
fs.writeFileSync(
path.join(process.cwd(), 'dist', 'antd-dark.less'),
path.join(process.cwd(), 'dist', 'dark.less'),
'@import "../lib/style/dark.less";\n@import "../lib/style/components.less";',
);
// eslint-disable-next-line
console.log('Built a entry less file to dist/antd-dark.less');
console.log('Built a entry less file to dist/dark.less');
// Build antd-dark.js: dist/antd-dark.js, for less-loader
// Build dark.js: dist/dark.js, for less-loader
const stylePath = path.join(process.cwd(), 'components', 'style');
const colorLess = fs.readFileSync(path.join(stylePath, 'color', 'colors.less'), 'utf8');
@ -82,12 +82,12 @@ function finalizeDist() {
});
fs.writeFileSync(
path.join(process.cwd(), 'dist', 'antd-dark.js'),
path.join(process.cwd(), 'dist', 'dark.js'),
`module.exports = ${JSON.stringify(darkPaletteLess, null, 2)};`,
);
// eslint-disable-next-line
console.log('Built a dark theme js file to dist/antd-dark.js');
console.log('Built a dark theme js file to dist/dark.js');
}
}

View File

@ -104,16 +104,16 @@ Note: This way will load the styles of all components, regardless of your demand
![](https://gw.alipayobjects.com/zos/antfincdn/wp6GpGo%26ID/f31e18a4-2018-4e12-95c6-998e7ac5b2fa.png)
include `antd/dist/antd-dark.less` in the style file:
include `antd/dist/dark.less` in the style file:
```less
@import '~antd/dist/antd-dark.less'; // Introduce the official dark less style entry file
@import '~antd/dist/dark.less'; // Introduce the official dark less style entry file
```
Another approach to using [less-loader](https://github.com/webpack-contrib/less-loader) in `webpack.config.js` to introduce as needed:
```js
const darkThemeVars = require('antd/dist/antd-dark');
```diff
const darkThemeVars = require('antd/dist/dark');
// webpack.config.js
module.exports = {

View File

@ -104,16 +104,16 @@ module.exports = {
![](https://gw.alipayobjects.com/zos/antfincdn/wp6GpGo%26ID/f31e18a4-2018-4e12-95c6-998e7ac5b2fa.png)
一种方式是在样式文件全量引入 `antd/dist/antd-dark.less`
一种方式是在样式文件全量引入 `antd/dist/dark.less`
```less
@import '~antd/dist/antd-dark.less'; // 引入官方提供的暗色 less 样式入口文件
@import '~antd/dist/dark.less'; // 引入官方提供的暗色 less 样式入口文件
```
另一种是用在 `webpack.config.js` 使用 [less-loader](https://github.com/webpack-contrib/less-loader) 按需引入:
```js
const darkThemeVars = require('antd/dist/antd-dark');
```diff
const darkThemeVars = require('antd/dist/dark');
// webpack.config.js
module.exports = {

View File

@ -10,8 +10,8 @@ $('dist')
.hasFile('antd.js')
.hasFile('antd.min.js')
.hasFile('antd.less')
.hasFile('antd-dark.less')
.hasFile('antd-dark.js');
.hasFile('dark.less')
.hasFile('dark.js');
// eslint-disable-next-line
console.log(chalk.green('✨ `dist` directory is valid.'));