Skip to content

Commit 0f54a60

Browse files
committed
Switch from :not(:last-child) to :not(template) ~ :not(template)
1 parent b7e0f11 commit 0f54a60

File tree

8 files changed

+451
-415
lines changed

8 files changed

+451
-415
lines changed

__tests__/fixtures/tailwind-output-important.css

Lines changed: 190 additions & 190 deletions
Large diffs are not rendered by default.

__tests__/fixtures/tailwind-output.css

Lines changed: 190 additions & 190 deletions
Large diffs are not rendered by default.

__tests__/plugins/divideColor.test.js

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,48 @@ test('generating divide color utilities', () => {
4040
expect(utilities).toEqual([
4141
[
4242
{
43-
'.divide-purple > * + *': { 'border-color': 'purple' },
44-
'.divide-white-25 > * + *': { 'border-color': 'rgba(255,255,255,.25)' },
45-
'.divide-white-50 > * + *': { 'border-color': 'rgba(255,255,255,.5)' },
46-
'.divide-white-75 > * + *': { 'border-color': 'rgba(255,255,255,.75)' },
47-
'.divide-white > * + *': { 'border-color': '#fff' },
48-
'.divide-red-1 > * + *': { 'border-color': 'rgb(33,0,0)' },
49-
'.divide-red-2 > * + *': { 'border-color': 'rgb(67,0,0)' },
50-
'.divide-red-3 > * + *': { 'border-color': 'rgb(100,0,0)' },
51-
'.divide-green-1 > * + *': { 'border-color': 'rgb(0,33,0)' },
52-
'.divide-green-2 > * + *': { 'border-color': 'rgb(0,67,0)' },
53-
'.divide-green-3 > * + *': { 'border-color': 'rgb(0,100,0)' },
54-
'.divide-blue-1 > * + *': { 'border-color': 'rgb(0,0,33)' },
55-
'.divide-blue-2 > * + *': { 'border-color': 'rgb(0,0,67)' },
56-
'.divide-blue-3 > * + *': { 'border-color': 'rgb(0,0,100)' },
43+
'.divide-purple > :not(template) ~ :not(template)': {
44+
'border-color': 'purple',
45+
},
46+
'.divide-white-25 > :not(template) ~ :not(template)': {
47+
'border-color': 'rgba(255,255,255,.25)',
48+
},
49+
'.divide-white-50 > :not(template) ~ :not(template)': {
50+
'border-color': 'rgba(255,255,255,.5)',
51+
},
52+
'.divide-white-75 > :not(template) ~ :not(template)': {
53+
'border-color': 'rgba(255,255,255,.75)',
54+
},
55+
'.divide-white > :not(template) ~ :not(template)': {
56+
'border-color': '#fff',
57+
},
58+
'.divide-red-1 > :not(template) ~ :not(template)': {
59+
'border-color': 'rgb(33,0,0)',
60+
},
61+
'.divide-red-2 > :not(template) ~ :not(template)': {
62+
'border-color': 'rgb(67,0,0)',
63+
},
64+
'.divide-red-3 > :not(template) ~ :not(template)': {
65+
'border-color': 'rgb(100,0,0)',
66+
},
67+
'.divide-green-1 > :not(template) ~ :not(template)': {
68+
'border-color': 'rgb(0,33,0)',
69+
},
70+
'.divide-green-2 > :not(template) ~ :not(template)': {
71+
'border-color': 'rgb(0,67,0)',
72+
},
73+
'.divide-green-3 > :not(template) ~ :not(template)': {
74+
'border-color': 'rgb(0,100,0)',
75+
},
76+
'.divide-blue-1 > :not(template) ~ :not(template)': {
77+
'border-color': 'rgb(0,0,33)',
78+
},
79+
'.divide-blue-2 > :not(template) ~ :not(template)': {
80+
'border-color': 'rgb(0,0,67)',
81+
},
82+
'.divide-blue-3 > :not(template) ~ :not(template)': {
83+
'border-color': 'rgb(0,0,100)',
84+
},
5785
},
5886
['responsive'],
5987
],

__tests__/plugins/divideWidth.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ test('generating divide width utilities', () => {
2121
expect(utilities).toEqual([
2222
[
2323
{
24-
'.divide-y-2 > * + *': { 'border-top-width': '2px' },
25-
'.divide-x-2 > * + *': { 'border-left-width': '2px' },
26-
'.divide-y-4 > * + *': { 'border-top-width': '4px' },
27-
'.divide-x-4 > * + *': { 'border-left-width': '4px' },
28-
'.divide-y-8 > * + *': { 'border-top-width': '8px' },
29-
'.divide-x-8 > * + *': { 'border-left-width': '8px' },
30-
'.divide-y > * + *': { 'border-top-width': '1px' },
31-
'.divide-x > * + *': { 'border-left-width': '1px' },
24+
'.divide-y-2 > :not(template) ~ :not(template)': { 'border-top-width': '2px' },
25+
'.divide-x-2 > :not(template) ~ :not(template)': { 'border-left-width': '2px' },
26+
'.divide-y-4 > :not(template) ~ :not(template)': { 'border-top-width': '4px' },
27+
'.divide-x-4 > :not(template) ~ :not(template)': { 'border-left-width': '4px' },
28+
'.divide-y-8 > :not(template) ~ :not(template)': { 'border-top-width': '8px' },
29+
'.divide-x-8 > :not(template) ~ :not(template)': { 'border-left-width': '8px' },
30+
'.divide-y > :not(template) ~ :not(template)': { 'border-top-width': '1px' },
31+
'.divide-x > :not(template) ~ :not(template)': { 'border-left-width': '1px' },
3232
},
3333
['responsive'],
3434
],

__tests__/plugins/space.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ test('generating space utilities', () => {
2121
expect(utilities).toEqual([
2222
[
2323
{
24-
'.space-y-1 > * + *': { 'margin-top': '1px' },
25-
'.space-x-1 > * + *': { 'margin-left': '1px' },
26-
'.space-y-2 > * + *': { 'margin-top': '2px' },
27-
'.space-x-2 > * + *': { 'margin-left': '2px' },
28-
'.space-y-4 > * + *': { 'margin-top': '4px' },
29-
'.space-x-4 > * + *': { 'margin-left': '4px' },
30-
'.space-y-8 > * + *': { 'margin-top': '8px' },
31-
'.space-x-8 > * + *': { 'margin-left': '8px' },
24+
'.space-y-1 > :not(template) ~ :not(template)': { 'margin-top': '1px' },
25+
'.space-x-1 > :not(template) ~ :not(template)': { 'margin-left': '1px' },
26+
'.space-y-2 > :not(template) ~ :not(template)': { 'margin-top': '2px' },
27+
'.space-x-2 > :not(template) ~ :not(template)': { 'margin-left': '2px' },
28+
'.space-y-4 > :not(template) ~ :not(template)': { 'margin-top': '4px' },
29+
'.space-x-4 > :not(template) ~ :not(template)': { 'margin-left': '4px' },
30+
'.space-y-8 > :not(template) ~ :not(template)': { 'margin-top': '8px' },
31+
'.space-x-8 > :not(template) ~ :not(template)': { 'margin-left': '8px' },
3232
},
3333
['responsive'],
3434
],

src/plugins/divideColor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function() {
88
const utilities = _.fromPairs(
99
_.map(_.omit(colors, 'default'), (value, modifier) => {
1010
return [
11-
`.${e(`divide-${modifier}`)} > :not(:last-child)`,
11+
`.${e(`divide-${modifier}`)} > :not(template) ~ :not(template)`,
1212
{
1313
'border-color': value,
1414
},

src/plugins/divideWidth.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ export default function() {
44
return function({ addUtilities, e, theme, variants }) {
55
const generators = [
66
(value, modifier) => ({
7-
[`.${e(`divide-y${modifier}`)} > :not(:last-child)`]: { 'border-bottom-width': `${value}` },
8-
[`.${e(`divide-x${modifier}`)} > :not(:last-child)`]: { 'border-right-width': `${value}` },
7+
[`.${e(`divide-y${modifier}`)} > :not(template) ~ :not(template)`]: {
8+
'border-top-width': `${value}`,
9+
},
10+
[`.${e(`divide-x${modifier}`)} > :not(template) ~ :not(template)`]: {
11+
'border-left-width': `${value}`,
12+
},
913
}),
1014
]
1115

src/plugins/space.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ export default function() {
44
return function({ addUtilities, e, theme, variants }) {
55
const generators = [
66
(size, modifier) => ({
7-
[`.${e(`space-y-${modifier}`)} > :not(:last-child)`]: { 'margin-bottom': `${size}` },
8-
[`.${e(`space-x-${modifier}`)} > :not(:last-child)`]: { 'margin-right': `${size}` },
7+
[`.${e(`space-y-${modifier}`)} > :not(template) ~ :not(template)`]: {
8+
'margin-top': `${size}`,
9+
},
10+
[`.${e(`space-x-${modifier}`)} > :not(template) ~ :not(template)`]: {
11+
'margin-left': `${size}`,
12+
},
913
}),
1014
]
1115

0 commit comments

Comments
 (0)