Skip to content

postcss-debug-logger #950

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

Merged
merged 2 commits into from
Apr 17, 2023
Merged

Conversation

romainmenke
Copy link
Member

I often create variations of this plugin when something is causing an infinite loop.
This just logs whatever is being visited by PostCSS :

sample :

Root
  index      : N/A
  nodes      : 1
  input.from : test/document.html

Declaration
  prop       : color
  value      : red
  index      : 0
  raw        : {"before":"","between":": "}
  input.from : test/document.html

DeclarationExit
  prop       : color
  value      : red
  index      : 0
  raw        : {"before":"","between":": "}
  input.from : test/document.html

RootExit
  index      : N/A
  nodes      : 1
  input.from : test/document.html

DocumentExit
  nodes      : 2
  input.from : test/document.html

OnceExit
  index      : N/A
  nodes      : 2
  input.from : test/document.html

OnceExit
  index      : N/A
  nodes      : 1
  input.from : test/document.html

It makes it possible to find the general location and sometimes the exact CSS that is causing freezes/hangs.

I didn't really find it necessary before to make this into a real plugin and publish it, but apparently there are still frameworks/stacks that do not allow passing plugin instances and require users to pass module names. The alternative is fiddling with npm link, which I do not like either.

This plugin can also be used by our users as a way to provide us with more debug info.

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

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

This is great! Sad that has to be done but great!

Thanks! 🙇🏻

@romainmenke romainmenke merged commit f28e1d1 into main Apr 17, 2023
@romainmenke romainmenke deleted the debug-plugin--amiable-tuatara-6a8d82f3e0 branch April 17, 2023 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants