Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(preset-wind): add list-image rule #2484

Merged
merged 5 commits into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/preset-wind/src/rules/behaviors.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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