feat: add UnoCSS snap usage (#374)

This commit is contained in:
Chris 2025-09-01 21:46:22 +08:00 committed by GitHub
parent 4d4073932c
commit f65e6dbb4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -68,6 +68,8 @@ export const SnippetMap: Record<string, Record<string, Snippet>> = {
'astro': { name: 'Astro', lang: 'astro', prettierParser: 'typescript' },
'react-native': { name: 'React Native', lang: 'tsx', prettierParser: 'typescript' },
'unplugin': { name: 'Unplugin Icons', lang: 'tsx', prettierParser: 'typescript' },
'unocss': { name: 'UnoCSS', lang: 'html', prettierParser: 'html' },
'unocss-attributify': { name: 'UnoCSS', tag: 'attributify', lang: 'html', prettierParser: 'html' },
},
Links: {
url: { name: 'URL', lang: 'html', prettierParser: 'html' },
@ -128,6 +130,10 @@ export async function getIconSnippet(
return SvgToReactNative(await getSvg(collections, icon, undefined, color), toComponentName(icon), snippet)
case 'unplugin':
return `import ${toComponentName(icon)} from '~icons/${icon.split(':')[0]}/${icon.split(':')[1]}'`
case 'unocss':
return `<div class="i-${icon}" />`
case 'unocss-attributify':
return `<div i-${icon} />`
}
}