Closed ddengler closed 1 year ago
@ddengler Does this work for you to automatically format tailwind classes in heex files? I can't get vscode to automatically format these (need to manually run mix format
). what do your settings look like for [phoenix-heex]
?
{
"html": [
"HTML (EEx)",
"htm",
"html"
]
},
"files.associations": {
"*.js": "javascript",
"*.ex": "elixir",
"*.exs": "elixir",
"*.html.eex": "html-eex",
"*.html.leex": "html-eex",
"*.eex": "html-eex",
"*.leex": "html-eex",
"*.heex": "phoenix-heex",
"*.html.heex": "phoenix-heex",
},
"tailwindCSS.experimental.classRegex": [
"class:\\s*\"([^\"]*)\""
],
"tailwindCSS.includeLanguages": {
"html-eex": "html",
"phoenix-heex": "html",
"html": "html",
"elixir": "html",
"eex": "html"
},
"editor.formatOnSave": true,
"[phoenix-heex]": {
"editor.defaultFormatter": "animus-coop.vscode-elixir-mix-formatter"
},
}
These are all my possibly relevant settings. Also the animus-coop.vscode-elixir-mix-formatter is installed as a plugin to auto-run the mix format task. Hope this helps?
Sure! Cleaner solution than the bash script. If you're using this library you are definitely using phoenix/heex so may as well include it as a dependency.
Thanks for the provided file. I'll include it along with new instructions.
edit: fully implemented with correct namespace on commit https://github.com/100phlecs/tailwind_formatter/commit/685f8a55e3190fb8ed28265842e8ee9e897e9409
Thanks for the formatter. Exactly what I was looking for.
I created an alternative workaround for the mix limitations prior to the unreleased 1.15 for my use case looking like this, so I can still use this properly with my vscode plugin formatting files on save:
Maybe this is useful to you or could provide a basis for a more generic workaround in you project.