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.

https://github.com/adamzapasnik/prettier-plugin-eex

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:
https://github.com/adamzapasnik/prettier-plugin-erb

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:

Last Post!

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

Where Next?

Popular in Announcing Top

Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
Crowdhailer
Experimenting with this code. OK.try do user &lt;- fetch_user(1) cart &lt;- fetch_cart(1) order = checkout(cart, user) save_orde...
New
versilov
Could not wait for the missing Elixir ML libraries to appear, so, I wrote one myself, taking https://github.com/sdwolfz/exlearn as a foun...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44608 311
New
maltoe
Hello! Came here to announce ChromicPDF, a pet project PDF generator I’ve been working on for the past few months. Why another PDF gener...
New
Qqwy
TypeCheck: Fast and flexible runtime type-checking for your Elixir projects. Core ideas Type- and function specifications are const...
336 14713 100
New
zachdaniel
Ash Framework What is Ash? Ash Framework is a declarative, resource-oriented application development framework for Elixir. A resource can...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54996 245
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement