Skip to content

Commit bac5ecf

Browse files
adamwathanRobinMalfaitthecrypticaceneupauer
authored
Add list-style-image support (#10817)
* add `listStyle` instead of `listStyleType` Co-authored-by: Adam Wathan <[email protected]> Co-authored-by: Jordan Pittman <[email protected]> * add `listStyleType` related deprecation warnings * Implement list-style-image as separate plugin * Remove unused code, update tests * Always generate `list-none`, don't pull it from theme * Gracefully handle missing listStyleType configuration * Just use `list-image-*` fuck it * Update changelog --------- Co-authored-by: Robin Malfait <[email protected]> Co-authored-by: Adam Wathan <[email protected]> Co-authored-by: Jordan Pittman <[email protected]> Co-authored-by: Peter Neupauer <[email protected]>
1 parent 69d29c9 commit bac5ecf

9 files changed

+26
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
- Add `content-normal` and `content-stretch` utilities ([#10645](https://github.com/tailwindlabs/tailwindcss/pull/10645))
2222
- Add `line-clamp` utilities from `@tailwindcss/line-clamp` to core ([#10768](https://github.com/tailwindlabs/tailwindcss/pull/10768))
2323
- Support ESM and TypeScript config files ([#10785](https://github.com/tailwindlabs/tailwindcss/pull/10785))
24+
- Add `list-style-image` utilities ([#10817](https://github.com/tailwindlabs/tailwindcss/pull/10817))
2425

2526
### Fixed
2627

src/corePlugins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,8 +1093,8 @@ export let corePlugins = {
10931093
'.list-outside': { 'list-style-position': 'outside' },
10941094
})
10951095
},
1096-
10971096
listStyleType: createUtilityPlugin('listStyleType', [['list', ['listStyleType']]]),
1097+
listStyleImage: createUtilityPlugin('listStyleImage', [['list-image', ['listStyleImage']]]),
10981098

10991099
appearance: ({ addUtilities }) => {
11001100
addUtilities({

stubs/config.full.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,9 @@ module.exports = {
577577
disc: 'disc',
578578
decimal: 'decimal',
579579
},
580+
listStyleImage: {
581+
none: 'none',
582+
},
580583
margin: ({ theme }) => ({
581584
auto: 'auto',
582585
...theme('spacing'),

tests/arbitrary-values.oxide.test.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,12 @@
411411
.list-\[var\(--value\)\] {
412412
list-style-type: var(--value);
413413
}
414+
.list-image-\[url\(\.\/my-image\.png\)\] {
415+
list-style-image: url("./my-image.png");
416+
}
417+
.list-image-\[var\(--value\)\] {
418+
list-style-image: var(--value);
419+
}
414420
.columns-\[20\] {
415421
columns: 20;
416422
}

tests/arbitrary-values.test.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,12 @@
411411
.list-\[var\(--value\)\] {
412412
list-style-type: var(--value);
413413
}
414+
.list-image-\[url\(\.\/my-image\.png\)\] {
415+
list-style-image: url("./my-image.png");
416+
}
417+
.list-image-\[var\(--value\)\] {
418+
list-style-image: var(--value);
419+
}
414420
.columns-\[20\] {
415421
columns: 20;
416422
}

tests/arbitrary-values.test.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@
125125

126126
<div class="list-['\1f44d']"></div>
127127
<div class="list-[var(--value)]"></div>
128+
<div class="list-image-[url(./my-image.png)]"></div>
129+
<div class="list-image-[var(--value)]"></div>
128130

129131
<div class="columns-[20] columns-[var(--columns)]"></div>
130132

tests/basic-usage.oxide.test.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@
408408
.list-disc {
409409
list-style-type: disc;
410410
}
411+
.list-image-none {
412+
list-style-image: none;
413+
}
411414
.appearance-none {
412415
appearance: none;
413416
}

tests/basic-usage.test.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@
408408
.list-disc {
409409
list-style-type: disc;
410410
}
411+
.list-image-none {
412+
list-style-image: none;
413+
}
411414
.appearance-none {
412415
appearance: none;
413416
}

tests/basic-usage.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ crosscheck(({ stable, oxide }) => {
8989
<div class="leading-relaxed leading-5"></div>
9090
<div class="list-inside"></div>
9191
<div class="list-disc"></div>
92+
<div class="list-image-none"></div>
9293
<div class="m-4 my-2 mx-auto mt-0 mr-1 mb-3 ml-4"></div>
9394
<div class="max-h-screen"></div>
9495
<div class="max-w-full"></div>

0 commit comments

Comments
 (0)