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 a followup to the original PR installing Tailwind: https://github.com/dsernst/siv/pull/122
This PR creates a component for the default tailwind reset file (called Preflight, aka
@tailwind base
).Historically, this has been disabled on all of siv.org, because so much of the site was designed and coded pre-Tailwind. Without disabling the reset file, tons of things were unexpectedly changing throughout the whole site.
This new
<TailwindPreflight />
component makes it so individual pages can opt-in to the preflight, closer to how Tailwind behaves by default.All new pages going forward should add this
<TailwindPreflight />
component.IntroPage.tsx
was created as an example.global
reset styles when client-side switching between pages? Untested.Post Merge Next Steps
Once this is merged, it will allow us to start taking pages one-by-one and configuring them to be compatible with Preflight.
That's not urgent, but once all pages are done, we can re-enable Preflight app wide, instead of page-by-page, to simplify things.
Development background, getting this to work
It took many hours, false starts with too many bugs, and rewrites to get this version that seemingly works pretty well. An earlier approach tries to conditionally
require('tailwind-preflight.css')
which itself imported@tailwind base
. That mostly worked but caused a Flash of Unstructured Content on initial page load.Although the old way of disabling, via tailwind.config.jsUpdate: Went back to the old way becausepreflight: false
was and would continue to work, as part of the previous approaches, this PR removes that, and instead comments out the@tailwind base
directive. This does the same thing, and is a bit simpler to follow (thepreflight: false
is unnecessarily magical). This new way also leaves a comment in tailwind.css, next to the commented outbase
, mentioning the new opt-in<TailwindPreflight />
component.@tailwind base
contains necessary default css variables like--tw-gradient-end-position
.