ant-design/scripts/generateColorLess.js

50 lines
1.2 KiB
JavaScript
Raw Normal View History

#!/usr/bin/env node
const path = require('path');
2019-12-23 16:30:32 +08:00
const { generateTheme } = require('antd-theme-generator');
2019-12-24 18:26:35 +08:00
const genCss = require('antd-pro-merge-less');
const defaultVar = require('./default-vars');
2019-12-24 18:26:35 +08:00
const dark = require('./dark-vars');
const compact = require('./compact-vars');
2019-12-24 18:26:35 +08:00
genCss(
path.join(__dirname, '..'),
[
{
theme: 'dark',
fileName: './_site/dark.css',
modifyVars: {
...defaultVar,
2019-12-24 18:26:35 +08:00
...dark,
'@site-text-color': '@heading-color',
2019-12-24 18:26:35 +08:00
'@site-markdown-code-bg': '@input-bg',
},
},
{
theme: 'compact',
fileName: './_site/compact.css',
modifyVars: {
...defaultVar,
...compact,
},
},
2019-12-24 18:26:35 +08:00
],
{
ignoreAntd: true,
isModule: false,
cache: false,
loadAny: true,
ignoreProLayout: true,
},
);
2019-12-23 16:30:32 +08:00
const options = {
stylesDir: path.join(__dirname, '../site/theme/static'),
antdStylesDir: path.join(__dirname, '../components'),
varFile: path.join(__dirname, '../components/style/themes/default.less'),
mainLessFile: path.join(__dirname, '../site/theme/static/index.less'),
themeVariables: ['@primary-color'],
outputFilePath: path.join(__dirname, '../_site/color.less'),
};
generateTheme(options);