From a000307d6f68e31263d7cfa9110fb447530d88b0 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Fri, 10 May 2024 19:52:48 +0300 Subject: [PATCH] chore(tailwind): make prefixes list optional --- plugins-demo/tailwind-demo/tailwind.config.js | 3 +-- plugins/tailwind/src/helpers/options.ts | 2 +- plugins/tailwind/src/preparsed.ts | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins-demo/tailwind-demo/tailwind.config.js b/plugins-demo/tailwind-demo/tailwind.config.js index 40dbbff..38b00a0 100644 --- a/plugins-demo/tailwind-demo/tailwind.config.js +++ b/plugins-demo/tailwind-demo/tailwind.config.js @@ -89,8 +89,7 @@ module.exports = { maskSelector: '.iconify-nosize', backgroundSelector: '', scale: 0, - // Empty prefixes list: reusing data from plugin above - prefixes: [], + // No prefixes list: reusing data from plugin above }), // Plugin with clean selectors: requires writing all used icons in first parameter addCleanIconSelectors(['mdi-light:home']), diff --git a/plugins/tailwind/src/helpers/options.ts b/plugins/tailwind/src/helpers/options.ts index c93a2f2..842bfbb 100644 --- a/plugins/tailwind/src/helpers/options.ts +++ b/plugins/tailwind/src/helpers/options.ts @@ -95,7 +95,7 @@ export interface IconifyPluginOptionsObject { scale?: number; // Prefixes to load - prefixes: IconifyPluginListOptions; + prefixes?: IconifyPluginListOptions; // Customise callback customise?: (content: string, name: string, prefix: string) => string; diff --git a/plugins/tailwind/src/preparsed.ts b/plugins/tailwind/src/preparsed.ts index 1027a45..69df4a8 100644 --- a/plugins/tailwind/src/preparsed.ts +++ b/plugins/tailwind/src/preparsed.ts @@ -73,7 +73,7 @@ export function getCSSRulesForPlugin(options: IconifyPluginOptions) { // Add icon sets const iconSelector = fullOptions.iconSelector || '.{prefix}--{name}'; - fullOptions.prefixes.forEach((item) => { + fullOptions.prefixes?.forEach((item) => { let prefix: string; let iconSet: IconifyJSON | undefined; let iconsList: IconsListOption | undefined;