mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
parent
3789e0cbbb
commit
dbae84c83d
@ -4,13 +4,43 @@
|
||||
'use strict';
|
||||
|
||||
// Build a entry less file to dist/antd.less
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const packageInfo = require('../package.json');
|
||||
|
||||
if (fs.existsSync(path.join(__dirname, '../dist'))) {
|
||||
fs.writeFileSync(path.join(process.cwd(), 'lib', 'version.js'), `
|
||||
module.exports = '${packageInfo.version}';
|
||||
`);
|
||||
|
||||
const antdV = `
|
||||
(function(root) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports.version = '${packageInfo.version}';
|
||||
else
|
||||
root["antd"].version = '${packageInfo.version}';
|
||||
})(this);
|
||||
`;
|
||||
|
||||
const antdPath = path.join(process.cwd(), 'dist', 'antd.js');
|
||||
const antdMinPath = path.join(process.cwd(), 'dist', 'antd.min.js');
|
||||
|
||||
if (fs.existsSync(antdPath)) {
|
||||
const content = fs.readFileSync(antdPath, 'utf-8');
|
||||
const minContent = fs.readFileSync(antdMinPath, 'utf-8');
|
||||
fs.writeFileSync(antdPath, `
|
||||
${content}
|
||||
${antdV}
|
||||
`);
|
||||
fs.writeFileSync(antdMinPath, `
|
||||
${minContent}
|
||||
${antdV}
|
||||
`);
|
||||
}
|
||||
|
||||
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 = '';
|
||||
const componentsPath = path.join(process.cwd(), 'components');
|
||||
let componentsLessContent = '';
|
||||
|
||||
// Build components in one file: lib/style/components.less
|
||||
fs.readdir(componentsPath, function (err, files) {
|
||||
|
Loading…
Reference in New Issue
Block a user