adamzapasnik

adamzapasnik

Prettier eex plugin

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 <style> and <script> tags, it something I have to work a bit more on.

If you got any questions ask here or on Github.

Most Liked

adamzapasnik

adamzapasnik

Release v0.2.0

Changes

  • decoding/encoding logic has been extracted to prettier-html-templates package

Fixed

  • 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:

PJUllrich

PJUllrich

Author of Building Table Views with Phoenix LiveView

Small FYI if you want to install this wonderful plugin for every Elixir/Phoenix project:

  1. Install the prettier and prettier-plugin-eex npm packages globally with:
npm install -g prettier prettier-plugin-eex
  1. Make sure that you have the Prettier VSCode Extension installed.

  2. Find the global path to which npm installed your prettier package. These are some common paths:

# macOS
/usr/local/lib/node_modules/prettier

# unix
/usr/local/lib/node_modules/prettier

# Windows
%USERPROFILE%\AppData\Roaming\npm\node_modules/prettier
  1. Set that global path as a Prettier: Prettier Path either in your Settings under Extensions > Prettier > Prettier: Prettier Path or in your settings.json directly:
"prettier.prettierPath": GLOBAL_PATH
# e.g. "prettier.prettierPath": "/usr/local/lib/node_modules/prettier"

Thank you @adamzapasnik for this great plugin!

akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

I’ll be taking a look for sure today! Thanks for this :smiley:

adamzapasnik

adamzapasnik

Release v0.5.0

Bug fixes

  • Return non 0 exit status when error formatting is unsuccessful
  • Use print function instead of embed to fix error logging
  • Fix formatting of files that consist of only a single expression
  • Make prettier_eex_formatter work on 21 and 22 OTP
egze

egze

mix.format doesn’t format eex template files.

Where Next?

Popular in Libraries Top

scohen
Lexical Lexical is a next-generation language server for the Elixir programming language. Features Context aware code completion As-you...
New
mhanberg
I just released the first version of Temple: an HTML DSL for Elixir and Phoenix! You can read this blog post or the docs for more info...
New
kevinlang
Hey all, We have made an Ecto3 Adapter for SQLite3, ecto_sqlite3! We have successfully on-boarded the full suite of integration tests (...
New
seancribbs
Today I released a new dialyzer Mix task as the dialyzex package! At the time we started writing this task, the existing dialyzer integra...
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New
pkrawat1
Presenting Aviacommerce, open source e-commerce platform in Elixir Aviacommerce is an open source e-commerce platform in Elixir. We at...
New
tmbb
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
Eiji
ExApi is a library that I’m developing now and hope release soon This library will allow to: list all apis list all api implementation...
New
Crowdhailer
Experimenting with this code. OK.try do user &lt;- fetch_user(1) cart &lt;- fetch_cart(1) order = checkout(cart, user) save_or...
New
OvermindDL1
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM. ...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

Sub Categories:

We're in Beta

About us Mission Statement