Commit 206e7c16 authored by 邓晓峰's avatar 邓晓峰

add gen_less_entry

parent 21aefbe0
Pipeline #26302 failed with stages
in 14 seconds
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
], ],
"scripts": { "scripts": {
"bootstrap": "node ./scripts/bootstrap.js", "bootstrap": "node ./scripts/bootstrap.js",
"build": "father-build && webpack", "build": "cross-env BUILD_TYPE=lib father-build && cross-env BUILD_TYPE=es father-build && webpack && node ./scripts/gen_less_entry.js",
"changelog": "pro-changelog", "changelog": "pro-changelog",
"createRelease": "node ./scripts/createRelease.js", "createRelease": "node ./scripts/createRelease.js",
"deploy": "npm run site && gh-pages -d ./dist", "deploy": "npm run site && gh-pages -d ./dist",
......
const fs = require('fs');
const { join } = require('path');
const fg = require('fast-glob');
const pkgList = fs
.readdirSync(join(__dirname, '../', 'packages'))
.filter((pkg) => pkg.charAt(0) !== '.');
pkgList.map(async (path) => {
const baseUrl = `${join(__dirname, '../', 'packages')}/${path}/src`;
const lessFiles = await fg(`${baseUrl}/**/*.less`, {
ignore: ['**/demos/**'],
deep: 5,
});
const importFiles = lessFiles.map((lessPath) => {
return `@import "../es${lessPath.replace(baseUrl, '')}";`;
});
const distPath = `${join(__dirname, '../', 'packages', path, 'dist', `${path}.less`)}`;
fs.writeFileSync(distPath, importFiles.join('\n'));
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment