components.less for custom less theme

This commit is contained in:
afc163 2016-04-29 15:31:07 +08:00
parent e9f083015e
commit 54045fc7c2
2 changed files with 12 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "1.0.0-beta.6",
"version": "1.0.0-beta.7",
"title": "Ant Design",
"description": "一个 UI 设计语言",
"homepage": "http://ant.design/",

View File

@ -6,15 +6,22 @@
// 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');
var componentsPath = path.join(process.cwd(), 'components');
var componentsLessContent = '';
// Build components in one file: lib/style/components.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')}";`
componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n`
}
});
fs.writeFileSync(path.join(process.cwd(), 'dist', 'antd.less'), entryLessContent);
fs.writeFileSync(path.join(process.cwd(), 'lib', 'style', 'components.less'), componentsLessContent);
// Build less entry file: dist/antd.less
fs.writeFileSync(
path.join(process.cwd(), 'dist', 'antd.less'),
'@import "../lib/style/index.less";\n@import "../lib/style/components.less";'
);
});