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

Header added wen formatting with prettier #811

Closed
luizcarlos1405 opened this issue May 21, 2022 · 2 comments
Closed

Header added wen formatting with prettier #811

luizcarlos1405 opened this issue May 21, 2022 · 2 comments

Comments

@luizcarlos1405
Copy link

luizcarlos1405 commented May 21, 2022

What's happening

When using prettier in a project that uses daisyui and prettier-plugin-tailwindcss, the daisyui header is added to the prettier output. This ends up in the file I'm trying to format.

I'll add that the problem only happens for me when using the prettier inside node_modules/.bin and not when using a globally installed prettier. If I uninstall prettier-plugin-tailwindcss the problem stops.

This seems to be a specific bad interaction between daisyui and prettier-plugin-tailwindcss.

Prettier version 2.6.2 (both the on inside node_modules and the globally installed)
DaisyUI version 2.15.0

What I've tried so far

  • Reinstalling prettier
  • Updating prettier and daisyui to latest versions

Other considerations

It boggles me that it doesn't happen with the prettier I installed with homebrew...

This person is having the same issue:
tailwindlabs/tailwindcss#8380

image

@saadeghi
Copy link
Owner

Thanks for reporting.
I answered here: tailwindlabs/tailwindcss#8380 (comment)

This is not something I can fix on my end. daisyUI just has console.logs in this file and it's meant to be printed on terminal after building the CSS, to inform the developer about the stuff daisyUI is adding. It should only be on the terminal (because it's just a console.log) and should not be added to the output file.

A workaround is to disable daisyUI logs from tailwind.config.js:

module.exports = {
  //...
  daisyui: {
    logs: false,
    //...
  },
}

Let me know if I can help

@ofseed
Copy link

ofseed commented Mar 27, 2024

If I call prettier with prettier -w, the header will be shown on the terminal and the correct formatted content will be written to the file. So I think prettier can distinguish the two kinds of output (obviously console.log will not write to any file), I would like to ask, how can I call prettier to get the formatted content only? I'm using a plugin to call prettier in neovim, and I'm finding a way to make it get the correct formatted content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants