Skip to content

Commit

Permalink
🎨 Improve Colorwind exports
Browse files Browse the repository at this point in the history
  • Loading branch information
siguici committed Jun 10, 2024
1 parent 657ca0f commit fc3114d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions packages/colorwind/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,16 @@ export class Colorwind extends Plugin<ColorwindConfig> {
}
}

function colorwind(): PluginWithoutOptions {
return plugin((api: PluginAPI) => new Colorwind(api, DEFAULT_OPTIONS));
}

function colorwind_with(): PluginWithOptions<ColorwindOptions> {
return plugin.withOptions((options: ColorwindOptions) => (api: PluginAPI) => {
export const colorwind: PluginWithOptions<ColorwindOptions> =
plugin.withOptions((options: ColorwindOptions) => (api: PluginAPI) => {
options.colors = options.colors ?? DEFAULT_COLORS;
options.utilities = options.utilities ?? DEFAULT_UTILITIES;
options.components = options.components ?? DEFAULT_COMPONENTS;
new Colorwind(api, options as ColorwindConfig);
});
}

colorwind.with = colorwind_with;
const _colorwind: PluginWithoutOptions = plugin(
(api: PluginAPI) => new Colorwind(api, DEFAULT_OPTIONS),
);

export default colorwind;
export default _colorwind;
2 changes: 1 addition & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import colorwind from 'colorwind';

export default {
plugins: [colorwind()],
plugins: [colorwind],
};

0 comments on commit fc3114d

Please sign in to comment.