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:
commit
9263d9c003
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user