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

Expose timing information in debug mode #14553

Merged
merged 4 commits into from
Sep 30, 2024
Merged

Conversation

RobinMalfait
Copy link
Member

This PR exposes when using the the DEBUG environment variable. This follows the DEBUG conventions where:

  • DEBUG=1
  • DEBUG=true
  • DEBUG=*
  • DEBUG=tailwindcss

Will enable the debug information, but when using:

  • DEBUG=0
  • DEBUG=false
  • DEBUG=-tailwindcss

It will not.

This currently only exposes some timings related to:

  1. Scanning for candidates
  2. Building the CSS
  3. Optimizing the CSS

We can implement a more advanced version of this where we also expose more fine grained information such as the files we scanned, the amount of candidates we found and so on. But I believe that this will be enough to start triaging performance related issues.

@RobinMalfait RobinMalfait changed the title Expose timings when using DEBUG=1 Expose timing information in debug mode Sep 30, 2024
Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff! one thought inline

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts of moving this into the node specific library instead? This way we don't need to be too defensive with accessing process.env and we can use a proper export for the three clients instead of having to rely on private bundled imports:

import * as env from '../../tailwindcss/src/env'

Could also be maybe a tailwindcss-shared private package that we only use for this. It just seems strange that this file is in the tailwindcss package but not part of the released tailwindcss npm package at all

This allows us to:
1. Not worry about `process` being available, because we are already in
   a node-like environment.
2. Use a proper import from the package
@RobinMalfait RobinMalfait enabled auto-merge (squash) September 30, 2024 14:21
@RobinMalfait RobinMalfait merged commit ab82efa into next Sep 30, 2024
3 checks passed
@RobinMalfait RobinMalfait deleted the feat/expose-debug-info branch September 30, 2024 14:39
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.

3 participants