Skip to content

Bugfix/partials sorting #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions .core/gulp.tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,36 @@ $assets: (
return partial.replace('reactium_modules/', '+');
}

return path.relative(
path.dirname(config.dest.modulesPartial),
path.resolve(rootPath, partial),
);
return path
.relative(
path.dirname(config.dest.modulesPartial),
path.resolve(rootPath, partial),
)
.split(/[\\\/]/g)
.join(path.posix.sep);
})
.map(partial => partial.replace(/\.scss$/, ''))
// sort by directory basename
.sort((a, b) => {
const aBase = path
.basename(path.dirname(a))
.toLocaleLowerCase();
const bBase = path
.basename(path.dirname(b))
.toLocaleLowerCase();
if (aBase > bBase) return 1;
if (aBase < bBase) return -1;
return 0;
})
// sort by file basename
.sort((a, b) => {
const aBase = path.basename(a).toLocaleLowerCase();
const bBase = path.basename(b).toLocaleLowerCase();
if (aBase > bBase) return 1;
if (aBase < bBase) return -1;
return 0;
})
// sort by priority
.sort((a, b) => {
const aMatch =
SassPartialRegistry.list.find(({ pattern }) =>
Expand Down