Support customization via CSS custom properties #49
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.
This is an alternative or supplement to #14. From rudimentary testing, evaluating a
tailwind.css.erb
file is extremely slow (10+ seconds). Sprockets will cache the output so that the cost does not need to be paid for every request, but that also raises the issue of cache invalidation. Using CSS custom properties sidesteps these concerns.There is a larger question of which customizations to support via CSS custom properties. Font families are an obvious and simple choice, which is why I've started with them.
In contrast, there are a few dozen spacing values, and full customization thereof would be more cumbersome. Also, speaking as a non-designer, the value of customizing them seems questionable, since they are already expressed in
rem
, and there is a clear linear relationship between them.The choice for color customization is less clear. Note that the default Tailwind color palette is all handpicked, because generating shades algorithmically currently yields suboptimal results. So whatever customization mechanism we provide would likely need to support specifying multiple shades. Also, speaking as a non-designer, the value of overriding concrete colors (e.g.
blue-500
) seems questionable. On the other hand, the ability to specify abstract colors (e.g.primary-darker
) seems valuable. Vanilla Tailwind doesn't include such abstract colors, but we could still make them a part of our offering and let the purger strip them away if they go unused.One more area for customization is the
tailwindcss-typography
plugin. It provides many low-level configuration options. At some point in the future it may provide higher-level configuration options, but we could provide our own in the mean time. For example,--tw-prose-color
and--tw-prose-heading-color
variables.