Hey guys I’ve just released a prettier eex plugin.
It’s still a bit WIP, if you detect any errors just add a file path to .prettierignore and submit an issue so I could fix it.
It probably doesn’t work well with
<script> tags, it something I have to work a bit more on.
If you got any questions ask here or on Github.
I’ll be taking a look for sure today! Thanks for this
- decoding/encoding logic has been extracted to prettier-html-templates package
- In some cases expressions weren’t decoded inside script tags - thanks to @dnsbty
Extracting that logic allowed me to release an erb version, here is a link:
Thank you so much for this plugin. I’ve been struggling with eex formatting for so log.
Small FYI if you want to install this wonderful plugin for every Elixir/Phoenix project:
- Install the
prettier-plugin-eex npm packages
npm install -g prettier prettier-plugin-eex
Make sure that you have the Prettier VSCode Extension installed.
Find the global path to which
npm installed your
prettier package. These are some common paths:
- Set that
global path as a
Prettier: Prettier Path either in your
Extensions > Prettier > Prettier: Prettier Path or in your
# e.g. "prettier.prettierPath": "/usr/local/lib/node_modules/prettier"
Thank you @adamzapasnik for this great plugin!
I’m new to Elixir, so pardon my ignorance.
I’m trying to understand, what are the benefits of using Prettier over mix format?
mix.format doesn’t format eex template files.