mirror of
https://github.com/iconify/iconify.git
synced 2025-01-06 07:20:40 +00:00
fix(utils): in generated css merge identical selectors
This commit is contained in:
parent
bba91bc538
commit
a742cf1d94
@ -120,10 +120,20 @@ export function getIconsCSS(
|
||||
const selector = Array.from(commonSelectors).join(
|
||||
newOptions.format === 'compressed' ? ',' : ', '
|
||||
);
|
||||
css.unshift({
|
||||
selector,
|
||||
rules: commonRules,
|
||||
});
|
||||
|
||||
// Check for same selector
|
||||
if (css.length === 1 && css[0].selector === selector) {
|
||||
css[0].rules = {
|
||||
// Common first, override later
|
||||
...commonRules,
|
||||
...css[0].rules,
|
||||
};
|
||||
} else {
|
||||
css.unshift({
|
||||
selector,
|
||||
rules: commonRules,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Format
|
||||
|
@ -320,17 +320,13 @@ describe('Testing CSS for multiple icons', () => {
|
||||
})
|
||||
).toBe(`.test--activity {
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
width: 1.5em;
|
||||
height: 1em;
|
||||
background-color: currentColor;
|
||||
-webkit-mask: no-repeat center / 100%;
|
||||
mask: no-repeat center / 100%;
|
||||
-webkit-mask-image: var(--svg);
|
||||
mask-image: var(--svg);
|
||||
}
|
||||
|
||||
.test--activity {
|
||||
width: 1.5em;
|
||||
--svg: ${expectedURL('activity')};
|
||||
}
|
||||
`);
|
||||
|
Loading…
Reference in New Issue
Block a user