2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-05 02:33:16 +00:00

Merge pull request #307 from sillvva/main

fix: create component classes for tailwind plugin
This commit is contained in:
Vjacheslav Trushkin 2024-05-13 19:46:01 +03:00 committed by GitHub
commit 9263d9c003
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,9 +39,23 @@ export function addDynamicIconSelectors(options?: DynamicIconifyPluginOptions) {
* Usage in HTML: <span class="iconify mdi-light--home" />
*/
export function addIconSelectors(options: IconifyPluginOptions) {
const rules = getCSSRulesForPlugin(options);
return plugin(({ addUtilities }) => {
addUtilities(rules);
const maskSelector =
'maskSelector' in options ? options.maskSelector : '.iconify';
const backgroundSelector =
'backgroundSelector' in options
? options.backgroundSelector
: '.iconify-color';
const {
[maskSelector]: iconify,
[backgroundSelector]: iconifyColor,
...icons
} = getCSSRulesForPlugin(options);
return plugin(({ addComponents, addUtilities }) => {
addComponents({
[maskSelector]: iconify,
[backgroundSelector]: iconifyColor,
});
addUtilities(icons);
});
}