User defined custom css functions and theme() default value #1212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I've added new method to the plugin api:
addFunctionthrough which users can define custom css functions, since we all have sometime unique requirements and it's easier and better to write a js function that has access to raw config than figuring out a way to hack it in css or hooking up sass/less to the project. So if you want to have a way to get some color from your config in a certain format you can just quickly add the exact method you need:Functions are being added after tailwinds own ones so it is possible to override
themefunction. Didn't do it for any specific reason, so the order can be changed if you want to enforcethememethod to be immutable.I've also changed
themefunction to behave like it's counterpart in css and returndefaultvalue if the requested item is object and hasdefaultfield. I think it's more consistent this way and if you still need the raw config value there'sconfigfunction.Waiting for some feedback :)