Skip to content

Commit

Permalink
chore: priority => order
Browse files Browse the repository at this point in the history
  • Loading branch information
AshoneA committed Mar 21, 2020
1 parent ac23aed commit 9e4d114
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions genModuleLess.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ const { winPath } = require('umi-utils');
const AddLocalIdentName = require('./AddLocalIdentName');
const replaceDefaultLess = require('./replaceDefaultLess');

// priorty:
// 3. other/**/index.less
// 2. other/**.less
// 1. site/theme/**/index.less
// 0. site/theme/**.less
const getLessPriorty = filename => {
let priority = 0;
// order:
// 0. other/**/index.less
// 1. other/**.less
// 2. site/theme/**/index.less
// 3. site/theme/**.less
const getLessOrder = filename => {
let order = 0;
if (filename.includes('index.less')) {
priority += 1;
order += 1;
}
if (!a.includes('site/theme')) {
priority += 2;
if (!filename.includes('site/theme')) {
order += 2;
}
return priority;
return order;
};

// read less file list
Expand All @@ -34,7 +34,7 @@ const genModuleLess = (parents, { isModule, filterFileLess }) => {
.sync(winPath(`${parents}/**/**.less`), {
ignore: ['**/node_modules/**', '**/es/**', '**/lib/**', '**/dist/**', '**/_site/**'],
})
.sort((a, b) => getLessPriorty(a) - getLessPriorty(b))
.sort((a, b) => getLessOrder(a) - getLessOrder(b))
.filter(filePath => {
if (
filePath.includes('ant.design.pro.less') ||
Expand Down

0 comments on commit 9e4d114

Please sign in to comment.