Skip to content

Make theme a function instead of an object when passed to config closures #774

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

Merged
merged 2 commits into from
Mar 16, 2019

Conversation

adamwathan
Copy link
Member

Previously we were passing the current theme object to lazily evaluated config closures, but this can lead to an unfortunate amount of boilerplate if you need to check for the presence of a given key before referencing it.

This PR makes theme a function instead, where you specify the path to look up as the first argument (using dot notation), and specify a default value if that path doesn't exist as a second argument, just like the theme function available in your CSS .

Resolves #770.

@adamwathan adamwathan merged commit c5c9a7a into next Mar 16, 2019
@adamwathan adamwathan deleted the theme-closure-function branch March 16, 2019 20:44
CvX added a commit to CvX/tailwindcss that referenced this pull request Mar 17, 2019
CvX added a commit to CvX/tailwindcss that referenced this pull request Mar 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant