mirror of
https://github.com/iconify/iconify.git
synced 2025-01-22 14:48:24 +00:00
chore: handle defaultStyle
and defaultClass
This commit is contained in:
parent
8b7641839e
commit
a1592498bb
@ -18,7 +18,20 @@ export async function loadIcon(
|
||||
}
|
||||
}
|
||||
|
||||
return await loadNodeBuiltinIcon(collection, icon, options);
|
||||
let svg = await loadNodeBuiltinIcon(collection, icon, options);
|
||||
|
||||
if (svg && options) {
|
||||
const { defaultStyle, defaultClass } = options
|
||||
// additional props and iconCustomizer takes precedence
|
||||
if (defaultClass && !svg.includes(' class='))
|
||||
svg = svg.replace('<svg ', `<svg class="${defaultClass}" `)
|
||||
// additional props and iconCustomizer takes precedence
|
||||
if (defaultStyle && !svg.includes(' style='))
|
||||
svg = svg.replace('<svg ', `<svg style="${defaultStyle}" `)
|
||||
}
|
||||
|
||||
|
||||
return svg;
|
||||
}
|
||||
|
||||
async function importFsModule(): Promise<typeof import('./fs') | undefined> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user