Skip to content

Commit ae8666d

Browse files
authored
Bugfix/partials sorting (#130)
* Fix windows path separators for generating DDD style partials. * Better default styles filename and domain sorting.
1 parent 5fe6cae commit ae8666d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.core/gulp.tasks.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,27 @@ $assets: (
681681
.join(path.posix.sep);
682682
})
683683
.map(partial => partial.replace(/\.scss$/, ''))
684+
// sort by directory basename
685+
.sort((a, b) => {
686+
const aBase = path
687+
.basename(path.dirname(a))
688+
.toLocaleLowerCase();
689+
const bBase = path
690+
.basename(path.dirname(b))
691+
.toLocaleLowerCase();
692+
if (aBase > bBase) return 1;
693+
if (aBase < bBase) return -1;
694+
return 0;
695+
})
696+
// sort by file basename
697+
.sort((a, b) => {
698+
const aBase = path.basename(a).toLocaleLowerCase();
699+
const bBase = path.basename(b).toLocaleLowerCase();
700+
if (aBase > bBase) return 1;
701+
if (aBase < bBase) return -1;
702+
return 0;
703+
})
704+
// sort by priority
684705
.sort((a, b) => {
685706
const aMatch =
686707
SassPartialRegistry.list.find(({ pattern }) =>

0 commit comments

Comments
 (0)