ttskch / prettier-plugin-tailwindcss-anywhere

A Prettier plugin for sorting TailwindCSS classes in any HTML-like language, like Twig etc⚡
MIT License
8 stars 0 forks source link

doesn't work with 'prettierd' #1

Open bitbirddev opened 2 weeks ago

bitbirddev commented 2 weeks ago

@ttskch great plugin idea! unfortunately i can't get it to work with @fsouza/prettierd. any idea why?

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@ttskch/prettier-plugin-tailwindcss-anywhere' imported from /Users/xxxx/noop.js

{
    "printWidth": 180,
    "tabWidth": 4,
    "plugins": ["@zackad/prettier-plugin-twig", "@ttskch/prettier-plugin-tailwindcss-anywhere", "prettier-plugin-tailwindcss"],
    "twigPrintWidth": 180,
    "twigAlwaysBreakObjects": false,
    "twigOutputEndblockName": true,
    "overrides": [
        {
            "files": "*.html.twig",
            "options": {
                "parser": "anywhere"
            }
        }
    ]
}
bitbirddev commented 2 weeks ago

btw: works great with prettier!

ttskch commented 2 weeks ago

@bitbirddev Thanks for your feedback!

But, hmm, I can't reproduce the problem in my environment.

When I run prettierd with the same .prettierrc as you, I get the following error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@zackad/prettier-plugin-twig' imported from /path/to/project/noop.js

If I remove @zackad/prettier-plugin-twig from plugins in .prettierrc, it works fine.

Could you tell me the exact steps to reproduce the problem in your environment?

Or, if possible, you could provide a Dockerfile that can build a Docker environment in which the problem can be reproduced, which will be the shortcut to solving the problem.

Regards.

ttskch commented 2 weeks ago

@bitbirddev Hi. The error that occurred in my environment was fixed by simply running prettierd restart. Please try it.

See also: https://github.com/stevearc/conform.nvim/issues/515#issuecomment-2278211471

bitbirddev commented 1 week ago

@ttskch thanks for the heads up! i can confirm that prettierd restart solves the error.

unfortunately i can't get all the plugins to work together. if @ttskch/prettier-plugin-tailwindcss-anywhere is loaded than twig formatting via @zackad/prettier-plugin-twig doesn't work anymore :/

if i change my .prettierrc to

    "overrides": [
        {
            "files": "*.html.twig",
            "options": {
                "parser": "twig"
            }
        }
    ]

than twig formatting works as expected but tailwinds class sorting is broken...

do you have any idea how to get those plugins to work together? this is driving me crazy ^^

ttskch commented 1 week ago

@bitbirddev Please refer to the following links.

I haven't actually tried these, but maybe they'll help you.