Skip to content

Commit 358e91c

Browse files
authored
postcss-custom-properties : reduce duplicate code generation (#620)
* add test case for current behaviour * prevent duplicate code generation * fix
1 parent 4695755 commit 358e91c

31 files changed

+434
-0
lines changed

plugin-packs/postcss-preset-env/test/basic.autoprefixer.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -611,3 +611,21 @@
611611
text-decoration: overline wavy pink;
612612
text-decoration-thickness: 3px;
613613
}
614+
615+
[dir="ltr"] .stage__container {
616+
left: 1rem;
617+
left: var(--size, 1rem);
618+
}
619+
620+
[dir="rtl"] .stage__container {
621+
right: 1rem;
622+
right: var(--size, 1rem);
623+
}
624+
625+
[dir="ltr"] .stage__container {
626+
left: 1rem;
627+
}
628+
629+
[dir="rtl"] .stage__container {
630+
right: 1rem;
631+
}

plugin-packs/postcss-preset-env/test/basic.autoprefixer.false.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -611,3 +611,21 @@
611611
text-decoration: overline wavy pink;
612612
text-decoration-thickness: 3px;
613613
}
614+
615+
[dir="ltr"] .stage__container {
616+
left: 1rem;
617+
left: var(--size, 1rem);
618+
}
619+
620+
[dir="rtl"] .stage__container {
621+
right: 1rem;
622+
right: var(--size, 1rem);
623+
}
624+
625+
[dir="ltr"] .stage__container {
626+
left: 1rem;
627+
}
628+
629+
[dir="rtl"] .stage__container {
630+
right: 1rem;
631+
}

plugin-packs/postcss-preset-env/test/basic.ch38.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -523,3 +523,21 @@
523523
text-decoration: overline wavy pink;
524524
text-decoration-thickness: 3px;
525525
}
526+
527+
[dir="ltr"] .stage__container {
528+
left: 1rem;
529+
left: var(--size, 1rem);
530+
}
531+
532+
[dir="rtl"] .stage__container {
533+
right: 1rem;
534+
right: var(--size, 1rem);
535+
}
536+
537+
[dir="ltr"] .stage__container {
538+
left: 1rem;
539+
}
540+
541+
[dir="rtl"] .stage__container {
542+
right: 1rem;
543+
}

plugin-packs/postcss-preset-env/test/basic.ch88-ff78-saf10.expect.css

+8
Original file line numberDiff line numberDiff line change
@@ -525,3 +525,11 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
525525
text-decoration: overline wavy pink;
526526
text-decoration-thickness: 3px;
527527
}
528+
529+
[dir="ltr"] .stage__container {
530+
left: var(--size, 1rem);
531+
}
532+
533+
[dir="rtl"] .stage__container {
534+
right: var(--size, 1rem);
535+
}

plugin-packs/postcss-preset-env/test/basic.ch88-ff78.expect.css

+8
Original file line numberDiff line numberDiff line change
@@ -507,3 +507,11 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
507507
.text-decoration-shorthand {
508508
text-decoration: 3px wavy pink overline;
509509
}
510+
511+
[dir="ltr"] .stage__container {
512+
left: var(--size, 1rem);
513+
}
514+
515+
[dir="rtl"] .stage__container {
516+
right: var(--size, 1rem);
517+
}

plugin-packs/postcss-preset-env/test/basic.ch88-ff78.no-is-pseudo.expect.css

+8
Original file line numberDiff line numberDiff line change
@@ -507,3 +507,11 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
507507
.text-decoration-shorthand {
508508
text-decoration: 3px wavy pink overline;
509509
}
510+
511+
[dir="ltr"] .stage__container {
512+
left: var(--size, 1rem);
513+
}
514+
515+
[dir="rtl"] .stage__container {
516+
right: var(--size, 1rem);
517+
}

plugin-packs/postcss-preset-env/test/basic.css

+4
Original file line numberDiff line numberDiff line change
@@ -405,3 +405,7 @@
405405
.text-decoration-shorthand {
406406
text-decoration: 3px wavy pink overline;
407407
}
408+
409+
.stage__container {
410+
inset-inline-start: var(--size, 1rem);
411+
}

plugin-packs/postcss-preset-env/test/basic.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -635,3 +635,21 @@
635635
text-decoration: overline wavy pink;
636636
text-decoration-thickness: 3px;
637637
}
638+
639+
[dir="ltr"] .stage__container {
640+
left: 1rem;
641+
left: var(--size, 1rem);
642+
}
643+
644+
[dir="rtl"] .stage__container {
645+
right: 1rem;
646+
right: var(--size, 1rem);
647+
}
648+
649+
[dir="ltr"] .stage__container {
650+
left: 1rem;
651+
}
652+
653+
[dir="rtl"] .stage__container {
654+
right: 1rem;
655+
}

plugin-packs/postcss-preset-env/test/basic.ff49.expect.css

+8
Original file line numberDiff line numberDiff line change
@@ -524,3 +524,11 @@
524524
text-decoration: overline wavy pink;
525525
text-decoration-thickness: 3px;
526526
}
527+
528+
.stage__container:dir(ltr) {
529+
left: var(--size, 1rem);
530+
}
531+
532+
.stage__container:dir(rtl) {
533+
right: var(--size, 1rem);
534+
}

plugin-packs/postcss-preset-env/test/basic.ff66.expect.css

+4
Original file line numberDiff line numberDiff line change
@@ -505,3 +505,7 @@
505505
text-decoration: overline wavy pink;
506506
text-decoration-thickness: 3px;
507507
}
508+
509+
.stage__container {
510+
inset-inline-start: var(--size, 1rem);
511+
}

plugin-packs/postcss-preset-env/test/basic.ie10.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -652,3 +652,21 @@
652652
text-decoration: overline wavy pink;
653653
text-decoration-thickness: 3px;
654654
}
655+
656+
[dir="ltr"] .stage__container {
657+
left: 1rem;
658+
left: var(--size, 1rem);
659+
}
660+
661+
[dir="rtl"] .stage__container {
662+
right: 1rem;
663+
right: var(--size, 1rem);
664+
}
665+
666+
[dir="ltr"] .stage__container {
667+
left: 1rem;
668+
}
669+
670+
[dir="rtl"] .stage__container {
671+
right: 1rem;
672+
}

plugin-packs/postcss-preset-env/test/basic.nesting.false.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -631,3 +631,21 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
631631
text-decoration: overline wavy pink;
632632
text-decoration-thickness: 3px;
633633
}
634+
635+
[dir="ltr"] .stage__container {
636+
left: 1rem;
637+
left: var(--size, 1rem);
638+
}
639+
640+
[dir="rtl"] .stage__container {
641+
right: 1rem;
642+
right: var(--size, 1rem);
643+
}
644+
645+
[dir="ltr"] .stage__container {
646+
left: 1rem;
647+
}
648+
649+
[dir="rtl"] .stage__container {
650+
right: 1rem;
651+
}

plugin-packs/postcss-preset-env/test/basic.nesting.true.expect.css

+4
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,7 @@
420420
-webkit-text-decoration: 3px wavy pink overline;
421421
text-decoration: 3px wavy pink overline;
422422
}
423+
424+
.stage__container {
425+
inset-inline-start: var(--size, 1rem);
426+
}

plugin-packs/postcss-preset-env/test/basic.op_mini.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -614,3 +614,21 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
614614
text-decoration: overline wavy pink;
615615
text-decoration-thickness: 3px;
616616
}
617+
618+
[dir="ltr"] .stage__container {
619+
left: 1rem;
620+
left: var(--size, 1rem);
621+
}
622+
623+
[dir="rtl"] .stage__container {
624+
right: 1rem;
625+
right: var(--size, 1rem);
626+
}
627+
628+
[dir="ltr"] .stage__container {
629+
left: 1rem;
630+
}
631+
632+
[dir="rtl"] .stage__container {
633+
right: 1rem;
634+
}

plugin-packs/postcss-preset-env/test/basic.preserve.true.expect.css

+51
Original file line numberDiff line numberDiff line change
@@ -1070,3 +1070,54 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
10701070
-moz-text-decoration: 3px wavy pink overline;
10711071
text-decoration: 3px wavy pink overline;
10721072
}
1073+
1074+
[dir="ltr"] .stage__container {
1075+
left: 1rem;
1076+
left: var(--size, 1rem);
1077+
}
1078+
1079+
[dir="ltr"] .stage__container {
1080+
left: 1rem;
1081+
left: var(--size, 1rem);
1082+
}
1083+
1084+
.stage__container:dir(ltr) {
1085+
left: 1rem;
1086+
left: var(--size, 1rem);
1087+
}
1088+
1089+
[dir="rtl"] .stage__container {
1090+
right: 1rem;
1091+
right: var(--size, 1rem);
1092+
}
1093+
1094+
[dir="rtl"] .stage__container {
1095+
right: 1rem;
1096+
right: var(--size, 1rem);
1097+
}
1098+
1099+
.stage__container:dir(rtl) {
1100+
right: 1rem;
1101+
right: var(--size, 1rem);
1102+
}
1103+
1104+
[dir="ltr"] .stage__container {
1105+
left: 1rem;
1106+
}
1107+
1108+
.stage__container:dir(ltr) {
1109+
left: 1rem;
1110+
}
1111+
1112+
[dir="rtl"] .stage__container {
1113+
right: 1rem;
1114+
}
1115+
1116+
.stage__container:dir(rtl) {
1117+
right: 1rem;
1118+
}
1119+
1120+
.stage__container {
1121+
inset-inline-start: 1rem;
1122+
inset-inline-start: var(--size, 1rem);
1123+
}

plugin-packs/postcss-preset-env/test/basic.safari15.expect.css

+4
Original file line numberDiff line numberDiff line change
@@ -452,3 +452,7 @@
452452
text-decoration: overline wavy pink;
453453
text-decoration-thickness: 3px;
454454
}
455+
456+
.stage__container {
457+
inset-inline-start: var(--size, 1rem);
458+
}

plugin-packs/postcss-preset-env/test/basic.stage0-ff49.expect.css

+8
Original file line numberDiff line numberDiff line change
@@ -525,3 +525,11 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
525525
text-decoration: overline wavy pink;
526526
text-decoration-thickness: 3px;
527527
}
528+
529+
.stage__container:dir(ltr) {
530+
left: var(--size, 1rem);
531+
}
532+
533+
.stage__container:dir(rtl) {
534+
right: var(--size, 1rem);
535+
}

plugin-packs/postcss-preset-env/test/basic.stage0-ff66.expect.css

+4
Original file line numberDiff line numberDiff line change
@@ -506,3 +506,7 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
506506
text-decoration: overline wavy pink;
507507
text-decoration-thickness: 3px;
508508
}
509+
510+
.stage__container {
511+
inset-inline-start: var(--size, 1rem);
512+
}

plugin-packs/postcss-preset-env/test/basic.stage0.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -636,3 +636,21 @@ h1.test-custom-selectors,h2.test-custom-selectors,h3.test-custom-selectors,h4.te
636636
text-decoration: overline wavy pink;
637637
text-decoration-thickness: 3px;
638638
}
639+
640+
[dir="ltr"] .stage__container {
641+
left: 1rem;
642+
left: var(--size, 1rem);
643+
}
644+
645+
[dir="rtl"] .stage__container {
646+
right: 1rem;
647+
right: var(--size, 1rem);
648+
}
649+
650+
[dir="ltr"] .stage__container {
651+
left: 1rem;
652+
}
653+
654+
[dir="rtl"] .stage__container {
655+
right: 1rem;
656+
}

plugin-packs/postcss-preset-env/test/basic.vendors-1.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -613,3 +613,21 @@
613613
text-decoration: overline wavy pink;
614614
text-decoration-thickness: 3px;
615615
}
616+
617+
[dir="ltr"] .stage__container {
618+
left: 1rem;
619+
left: var(--size, 1rem);
620+
}
621+
622+
[dir="rtl"] .stage__container {
623+
right: 1rem;
624+
right: var(--size, 1rem);
625+
}
626+
627+
[dir="ltr"] .stage__container {
628+
left: 1rem;
629+
}
630+
631+
[dir="rtl"] .stage__container {
632+
right: 1rem;
633+
}

plugin-packs/postcss-preset-env/test/basic.vendors-2.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -576,3 +576,21 @@
576576
text-decoration: overline wavy pink;
577577
text-decoration-thickness: 3px;
578578
}
579+
580+
.stage__container:dir(ltr) {
581+
left: 1rem;
582+
left: var(--size, 1rem);
583+
}
584+
585+
.stage__container:dir(rtl) {
586+
right: 1rem;
587+
right: var(--size, 1rem);
588+
}
589+
590+
.stage__container:dir(ltr) {
591+
left: 1rem;
592+
}
593+
594+
.stage__container:dir(rtl) {
595+
right: 1rem;
596+
}

plugin-packs/postcss-preset-env/test/basic.vendors-3.expect.css

+18
Original file line numberDiff line numberDiff line change
@@ -547,3 +547,21 @@
547547
-webkit-text-decoration: 3px wavy pink overline;
548548
text-decoration: 3px wavy pink overline;
549549
}
550+
551+
.stage__container:dir(ltr) {
552+
left: 1rem;
553+
left: var(--size, 1rem);
554+
}
555+
556+
.stage__container:dir(rtl) {
557+
right: 1rem;
558+
right: var(--size, 1rem);
559+
}
560+
561+
.stage__container:dir(ltr) {
562+
left: 1rem;
563+
}
564+
565+
.stage__container:dir(rtl) {
566+
right: 1rem;
567+
}

0 commit comments

Comments
 (0)