新增 build:less 命令
This commit is contained in:
parent
c9c0affe7a
commit
96f713d4d6
@ -2,5 +2,31 @@
|
||||
* merge less file
|
||||
* <p>
|
||||
*/
|
||||
var fs = require('fs');
|
||||
var { resolve } = require('path');
|
||||
|
||||
const inputDir = resolve(__dirname, './src/component')
|
||||
|
||||
const inputsArray = fs.readdirSync(inputDir).filter((name) => {
|
||||
const componentDir = resolve(inputDir, name)
|
||||
const isDir = fs.lstatSync(componentDir).isDirectory()
|
||||
return isDir && fs.readdirSync(componentDir).includes('index.ts')
|
||||
})
|
||||
|
||||
// 读取基础变量 与 公共样式
|
||||
var content = fs.readFileSync("./src/theme/variable.less").toString() + '\n\n';
|
||||
content += fs.readFileSync("./src/theme/index.less").toString() + '\n\n';
|
||||
|
||||
// 组件样式
|
||||
inputsArray.forEach(function (f) {
|
||||
var path = "./src/component/" + f + "/index.less";
|
||||
fs.exists(path,function(exists){
|
||||
if(exists){
|
||||
var c = fs.readFileSync(path);
|
||||
content += c.toString() + '\n\n';
|
||||
// 如何删除所有 @import 关键字
|
||||
content = content.replaceAll(/\@import.*?\;/g,"");
|
||||
fs.writeFileSync('./lib/index.less',content);
|
||||
}
|
||||
});
|
||||
})
|
@ -22,9 +22,10 @@
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite example",
|
||||
"build": "npm run build:all && npm run build:es && npm run build:types && npm run build:example",
|
||||
"build": "npm run build:all && npm run build:es && npm run build:less && npm run build:types && npm run build:example",
|
||||
"build:es": "vite build --emptyOutDir --config ./build.es.ts",
|
||||
"build:all": "vite build --emptyOutDir --config ./build.all.ts",
|
||||
"build:less": "node build.less.ts",
|
||||
"build:types": "rimraf types && tsc -d",
|
||||
"build:example": "vite build example",
|
||||
"lint:eslint": "eslint 'src/**/*.{vue,ts,tsx}' --fix",
|
||||
|
0
src/component/avatarList/index.less
Normal file
0
src/component/avatarList/index.less
Normal file
0
src/component/breadcrumb/index.less
Normal file
0
src/component/breadcrumb/index.less
Normal file
0
src/component/breadcrumbItem/index.less
Normal file
0
src/component/breadcrumbItem/index.less
Normal file
0
src/component/carousel/index.less
Normal file
0
src/component/carousel/index.less
Normal file
0
src/component/carouselItem/index.less
Normal file
0
src/component/carouselItem/index.less
Normal file
0
src/component/checkboxGroup/index.less
Normal file
0
src/component/checkboxGroup/index.less
Normal file
0
src/component/col/index.less
Normal file
0
src/component/col/index.less
Normal file
0
src/component/collapse/index.less
Normal file
0
src/component/collapse/index.less
Normal file
0
src/component/collapseItem/index.less
Normal file
0
src/component/collapseItem/index.less
Normal file
0
src/component/colorPicker/index.less
Normal file
0
src/component/colorPicker/index.less
Normal file
0
src/component/countUp/index.less
Normal file
0
src/component/countUp/index.less
Normal file
0
src/component/dropdown/index.less
Normal file
0
src/component/dropdown/index.less
Normal file
0
src/component/dropdownItem/index.less
Normal file
0
src/component/dropdownItem/index.less
Normal file
0
src/component/field/index.less
Normal file
0
src/component/field/index.less
Normal file
0
src/component/form/index.less
Normal file
0
src/component/form/index.less
Normal file
0
src/component/icon/index.less
Normal file
0
src/component/icon/index.less
Normal file
0
src/component/iconPicker/index.less
Normal file
0
src/component/iconPicker/index.less
Normal file
Loading…
Reference in New Issue
Block a user