@@ -540,6 +540,14 @@ $assets: (
540
540
} ;
541
541
542
542
const dddStylesPartial = done => {
543
+ const SassPartialSort = ReactiumGulp . Utils . registryFactory (
544
+ 'SassPartialSort' ,
545
+ 'id' ,
546
+ ReactiumGulp . Utils . Registry . MODES . CLEAN ,
547
+ ) ;
548
+
549
+ ReactiumGulp . Hook . runSync ( 'ddd-styles-partial-sort' , SassPartialSort ) ;
550
+
543
551
const stylePartials = globby
544
552
. sync ( config . src . styleDDD )
545
553
. map ( partial => {
@@ -552,7 +560,23 @@ $assets: (
552
560
path . resolve ( rootPath , partial ) ,
553
561
) ;
554
562
} )
555
- . map ( partial => partial . replace ( / \. s c s s $ / , '' ) ) ;
563
+ . map ( partial => partial . replace ( / \. s c s s $ / , '' ) )
564
+ . sort ( ( a , b ) => {
565
+ const aMatch =
566
+ SassPartialSort . list . find ( ( { pattern } ) =>
567
+ pattern . test ( a ) ,
568
+ ) || { } ;
569
+ const bMatch =
570
+ SassPartialSort . list . find ( ( { pattern } ) =>
571
+ pattern . test ( b ) ,
572
+ ) || { } ;
573
+ const aOrder = op . get ( aMatch , 'order' , 0 ) ;
574
+ const bOrder = op . get ( bMatch , 'order' , 0 ) ;
575
+
576
+ if ( aOrder > bOrder ) return 1 ;
577
+ else if ( bOrder > aOrder ) return - 1 ;
578
+ return 0 ;
579
+ } ) ;
556
580
557
581
const template = handlebars . compile ( `
558
582
// WARNING: Do not directly edit this file !!!!
@@ -649,6 +673,7 @@ $assets: (
649
673
gulp . watch ( config . watch . colors , gulp . task ( 'styles:colors' ) ) ;
650
674
gulp . watch ( config . watch . pluginAssets , gulp . task ( 'styles:pluginAssets' ) ) ;
651
675
gulp . watch ( config . watch . style , gulp . task ( 'styles:compile' ) ) ;
676
+ gulp . watch ( config . src . styleDDD , gulp . task ( 'styles:partials' ) ) ;
652
677
gulpwatch ( config . watch . markup , watcher ) ;
653
678
gulpwatch ( config . watch . assets , watcher ) ;
654
679
const scriptWatcher = gulp . watch (
0 commit comments