rustywind
rustywind copied to clipboard
dprint wasm plugin integration?
We've recently started using dprint as our formatter, but we miss this from prettier.
For context: https://dprint.dev/plugins/
I don't really know what's involved in making your tool compatible with dprint's plugin system, but it would be awesome.
Looks like this is the file that implements the interface: https://github.com/dprint/dprint-plugin-typescript/blob/main/src/wasm_plugin.rs
Release wasm version before doing this, publish *.wasm
to npm could save people from download file from Github.
We've switched to dprint as well, prettier's performance was killing us and dprint is much faster. The only thing we miss is the lack of tailwind sorting. This integration would be amazing!
I was able to get rustywind working with dprint using dprint's exec
plugin. Here's a minimal config:
{
"exec": {
"associations": "**/*.{jsx,tsx,html}",
"rustywind": "rustywind --stdin",
"rustywind.stdin": "true",
"rustywind.associations": "**/*.{jsx,tsx,html}"
},
"includes":"**/*.{tsx,jsx,html}",
"excludes": [
"**/node_modules",
],
"plugins": [
"https://plugins.dprint.dev/exec-0.3.5.json@d687dda57be0fe9a0088ccdaefa5147649ff24127d8b3ea227536c68ee7abeab"
]
}
(Note: rather than copying "https://plugins.dprint.dev/exec-0.3.5.json@d687dda57be0fe9a0088ccdaefa5147649ff24127d8b3ea227536c68ee7abeab"
into your config, run dprint config add exec
to add the latest version.)
It may not be not as good as a first-class integration, but it works and it's fast!
Edit January 2024:
The configuration format for dprint's exec plugin has changed. Here's what I'm using now:
{
"exec": {
"associations": "**/*.{jsx,tsx,html}",
"commands": [{
"command": "rustywind --stdin",
"exts": ["jsx", "tsx", "html"],
}],
},
"excludes": [
"**/node_modules",
"**/*-lock.json",
],
"plugins": [
"https://plugins.dprint.dev/exec-0.4.4.json@c207bf9b9a4ee1f0ecb75c594f774924baf62e8e53a2ce9d873816a408cecbf7",
],
}