2016-04-28 11:46:11 +08:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2016-04-28 15:54:18 +08:00
|
|
|
/* eslint-disable */
|
2016-04-28 12:22:47 +08:00
|
|
|
'use strict';
|
|
|
|
|
2016-04-28 15:54:18 +08:00
|
|
|
// Build a entry less file to dist/antd.less
|
|
|
|
var fs = require('fs');
|
|
|
|
var path = require('path');
|
2016-05-17 16:08:45 +08:00
|
|
|
|
|
|
|
if(fs.existsSync(path.join(__dirname,'../dist'))) {
|
|
|
|
console.log('Building a entry less file to dist/antd.less');
|
|
|
|
var componentsPath = path.join(process.cwd(), 'components');
|
|
|
|
var componentsLessContent = '';
|
2016-04-28 15:54:18 +08:00
|
|
|
|
2016-04-29 15:31:07 +08:00
|
|
|
// Build components in one file: lib/style/components.less
|
2016-05-17 16:08:45 +08:00
|
|
|
fs.readdir(componentsPath, function (err, files) {
|
|
|
|
files.forEach(function (file) {
|
|
|
|
if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) {
|
|
|
|
componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n`
|
|
|
|
}
|
|
|
|
});
|
|
|
|
fs.writeFileSync(path.join(process.cwd(), 'lib', 'style', 'components.less'), componentsLessContent);
|
2016-04-29 15:31:07 +08:00
|
|
|
|
2016-05-17 16:08:45 +08:00
|
|
|
// 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";'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|