Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add config customization support #4

Merged
merged 26 commits into from
Jul 2, 2024
Merged

Conversation

desmondinho
Copy link
Owner

@desmondinho desmondinho commented Jul 2, 2024

Closes #3

Continue to expand the functionality of this package according to the original one.
For this PR I've added the config customization support that allows:

  • Set LRU cache maximum capacity
  • Set custom prefix (e.g., "tw-"; tw-block)
  • Set custom separator (e.g., "_"; hover_bg-red-500)

Override and/or Extend

  • Theme
  • Class groups
  • Conflicting class groups
  • Conflicting class group modifiers

.. and all this can be done using AddTailwindMerge extension method that accepts a delegate of Action<TwMergeConfig>:

builder.Services.AddTailwindMerge(options =>
{
    options.CacheSize = 100;
    options.Prefix = "tw-";
    options.Separator = "_";

    options.Override( new ExtendedConfig()
    {
        Theme = [],
        ClassGroups = [],
        ConflictingClassGroups = [],
        ConflictingClassGroupModifiers = []
    } );

    options.Extend( new ExtendedConfig()
    {
        Theme = [],
        ClassGroups = [],
        ConflictingClassGroups = [],
        ConflictingClassGroupModifiers = []
    } );
};

@desmondinho desmondinho added the enhancement New feature or request label Jul 2, 2024
@desmondinho desmondinho self-assigned this Jul 2, 2024
@desmondinho desmondinho linked an issue Jul 2, 2024 that may be closed by this pull request
@desmondinho desmondinho merged commit 4ee2324 into main Jul 2, 2024
1 check passed
@desmondinho desmondinho deleted the feat/configuration branch July 2, 2024 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow config customization
1 participant