Skip to content

Commit

Permalink
feat(preset-wind): add list-image rule (#2484)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyyv committed Apr 22, 2023
1 parent 37f58a9 commit 3a93e7d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/preset-wind/src/rules/behaviors.ts
Expand Up @@ -34,6 +34,12 @@ export const listStyle: Rule[] = [
['list-outside', { 'list-style-position': 'outside' }],
['list-inside', { 'list-style-position': 'inside' }],
['list-none', { 'list-style-type': 'none' }],
// image
[/^list-image-(.+)$/, ([, d]) => {
if (/^\[url\(.+\)\]$/.test(d))
return { 'list-style-image': h.bracket(d) }
}],
['list-image-none', { 'list-style-image': 'none' }],
...makeGlobalStaticRules('list', 'list-style-type'),
]

Expand Down
2 changes: 2 additions & 0 deletions test/__snapshots__/postcss.test.ts.snap
Expand Up @@ -153,6 +153,8 @@ exports[`postcss > @unocss 1`] = `
.list-greek{list-style-type:lower-greek;}
.list-outside{list-style-position:outside;}
.list-none{list-style-type:none;}
.list-image-\\\\[url\\\\(https\\\\:\\\\/\\\\/test\\\\.unocss\\\\.png\\\\)\\\\]{list-style-image:url(https://test.unocss.png);}
.list-image-none{list-style-image:none;}
.list-inherit{list-style-type:inherit;}
.columns-\\\\[3_auto\\\\]{columns:3 auto;}
.columns-\\\\[auto_13em\\\\]{columns:auto 13em;}
Expand Down
2 changes: 2 additions & 0 deletions test/assets/output/preset-wind-targets.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions test/assets/preset-wind-targets.ts
Expand Up @@ -133,6 +133,8 @@ export const presetWindTargets: string[] = [
'list-disc-outside',
'list-alpha-inside',
'list-inherit',
'list-image-[url(https://test.unocss.png)]',
'list-image-none',
'box-decoration-slice',
'box-decoration-initial',
'accent-op-90',
Expand Down

0 comments on commit 3a93e7d

Please sign in to comment.