Skip to content

Preserve source maps for generated CSS - #7588

Merged
thecrypticace merged 5 commits into
masterfrom
fix/apply-source-maps
Feb 23, 2022
Merged

thecrypticace merged 5 commits into
masterfrom
fix/apply-source-maps

Conversation

@thecrypticace

Copy link
Copy Markdown
Contributor

Source maps were not preserved for CSS in many cases because:

  1. We needed to recursively associate CSS nodes with the appropriate input source
  2. Defaults expansion didn't preserve source maps
  3. Apply didn't correctly override source maps leading to generated rules having no associated source
  4. Some but not all preflight rules didn't have source maps because of the recursive copying problem.

This should fix all of those and we now have tests to verify that source maps are properly generated as well.

Apply source maps could be better. For instance it may make sense that the individual rules generated for @apply text-black font-mono would point to the columns for text-black and font-mono respectively. However, that is a lot of bookkeeping for not much gain. Having them all point to the apply line that generated them seems like a reasonable tradeoff.

Fixes #7583
Fixes #5043
Closes #7369

@thecrypticace
thecrypticace force-pushed the fix/apply-source-maps branch 2 times, most recently from e0c71bf to ab0c9db Compare February 23, 2022 16:20
@thecrypticace
thecrypticace marked this pull request as ready for review February 23, 2022 16:24
@thecrypticace
thecrypticace merged commit b94d565 into master Feb 23, 2022
@thecrypticace
thecrypticace deleted the fix/apply-source-maps branch February 23, 2022 16:24
@evenfrost

Copy link
Copy Markdown
Contributor

@thecrypticace do you have an idea when it can be released?

@thecrypticace

Copy link
Copy Markdown
Contributor Author

We moved some stuff around today just so we could get a patch release out with a whole slew of bug fixes! You can upgrade to v3.0.24!

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.

Tailwind preflight doesn't produce sourcemap file deterministically Enabling JIT breaks sourcemaps in webpack + PostCSS project

2 participants