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

Split up Tailwind configuration using presets #34

Merged
merged 8 commits into from
Oct 26, 2020

Conversation

robdekort
Copy link
Contributor

@robdekort robdekort commented Oct 24, 2020

Currently all the Tailwind (TW) configuration is in one big file. I always thought this was nice, because that way you don't have to add and keep track of multiple .scss files like we had to in the past. However the file grew bigger and complex. On top of that some of Peak's utilities might be intimidating to new users as well.

While reading up on TW 1.9 I stumbled across the concept of presets. This basically gives us a nice way to split up the config files. That way you can just assume stuff works but never have to be confronted with the configuration of Peaks utilities and components. You just use them.

For this draft PR I settled for the following files:

  • tailwind.config.js: The base TW config file refering the following ones:
  • tailwind.config.typography.js: The TW typography plugin config.
  • tailwind.config.forms.js: The TW form plugin config.
  • tailwind.config.peak.js: All Peak's configuration, utilities and components.
  • tailwind.config.site.js: Everything you need for your current site (theming).

With this setup you probably only ever edit the forms, typography and site config files. Those three files just contain your current projects configuration so it make more sense as it's your own. This seems more comprehensible to me. You probably also rarely have to add and keep track of added config files so that's a not an issue anymore.

Another benefit is that it's now easier to opt out of TW Typography and/or TW Forms if you don't want to use those.

What do you think?

@robdekort robdekort added enhancement New feature or request help wanted Extra attention is needed labels Oct 24, 2020
@robdekort robdekort changed the title Split up Tailwind configuration Split up Tailwind configuration using presets Oct 24, 2020
@robdekort robdekort self-assigned this Oct 24, 2020
@sjclark
Copy link
Contributor

sjclark commented Oct 24, 2020

What do you think?

Love it, great idea! 👍

@philipboomy
Copy link
Contributor

I went from one file CSS to TW so I loved the small config file however lately that config file has grown and its difficult to find the beginning and end of extend, plugins, etc in the file. So with that in mind I think this is a great idea.

@robdekort
Copy link
Contributor Author

Good to hear this might help. Any ideas on how the configuration bits should be documented?

@robdekort robdekort marked this pull request as ready for review October 26, 2020 08:58
@robdekort robdekort merged commit c557f6c into main Oct 26, 2020
@robdekort robdekort deleted the feature/tailwind-presets branch October 26, 2020 08:59
robdekort added a commit that referenced this pull request Dec 14, 2022
Split up Tailwind configuration using presets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants