Kurisu

Kurisu

How can a front-end developer collaborate with a back-end developer on a Phoenix 1.7 and LiveView project?

Hello everyone!

As a back-end developer who dislikes front-end work such as CSS and is not proficient in web and graphic design, I have the opportunity to collaborate with someone who is really experienced and skilled in these areas. Unfortunately, as I dislike CSS, he dislikes back-end development. So it’s not worth asking him to learn Phoenix or LiveView; I already know his answer. However, we have to work together on a Phoenix 1.7 and LiveView project.

I’m wondering how we can collaborate effectively to ensure that the project runs smoothly.
Specifically, I’m interested in learning how a front-end developer can design an HTML template styled with Tailwind CSS that can be easily used with Phoenix/LiveView.

Can anyone help me with some resources, tools or tips on how to get started? Or if you want to share your own experience on such collaboration, it would be welcome too! Thank you!”

Side note: “I’m still in the learning process with LiveView and its Components based Design approach. The front-end developer also is new to Tailwind CSS but somehow I managed to convince him to learn it so we can keep the LiveView defaults… I probably will learn also some Tailwind basics. So if my question is a bit naive, please bear with me.

Marked As Solved

Arz

Arz

Hello! I am happy to give my experience as we are in a similar situation.

On our current project my wife is one of the backend dev and the lead LiveView dev. My job is to do the UI and styling, along with many other things. My primary skills are in design, HTML, CSS, and some JS and an understanding of building website (plus GDPR, hosting, email services, etc.)

So my wife and I work together. She does the business logic and backend and then turns it over to me to make it look good, test it etc.

I do know a good amount of Elixir and Phoenix. I was hesitant about Tailwind but like it now. To use Tailwind you should be using components (like you would in React etc.). If you don’t, then it will be hard to maintain the CSS. Also, using Phoenix plus Tailwind is very nice. You can use attributes, slots, Phoenix.LiveView.JS, etc to do some amazing things on the front-end…really nice to work with.

Your front-end dev could give you the basic HTML templates but you would then need to add them to components, add attributes etc.

My conclusion is your front-end dev will need to know some Elixir/Phoenix to be effective. I am very new (probably not even a junior Elixir dev), but I am doing fine and enjoy it!

Any specific questions please let me know. I’ll do what I can to help.

Hope this helps!
Adam

Also Liked

mindok

mindok

A good front end dev should be able to re-organise elements and styling in either a heex template or inline heex - they don’t need to worry about event handlers, assigns, elixir code etc. Unless you’re happy to take on a lot of non-value adding work integrating their styling into your liveviews / components, you’re going to have to get them comfortable running Phoenix and editing directly in the project.

Communication is also key - define the high level UI “scaffolding” (e.g. hierarchy of controls) together, then you can work on the functionality and they can work on the styling.

FWIW - I really, really dislike fighting CSS. But I’ve been down the path of working with a standalone HTML / CSS developer and integrating their work. Learning Tailwind CSS and implementing directly off Figma designs was less of a pain than integrating their work. Best situation is definitely someone who loves the CSS stuff and can work directly in the Phoenix project.

I also have to say the quality-of-life improvements from the recent Phoenix component approach are amazing for the CSS-challenged, like myself. You’re definitely taking the right approach with learning about LiveView & Components. Tools like a Storybook for LiveView (https://phx-live-storybook-sample.fly.dev/storybook/welcome) may be helpful to build out and visualise the components you need. It’s much better to start out this way rather than trying to extract out big chunks of copy-pasted HTML/CSS later.

eahanson

eahanson

Just a note that Tailwind is only the default for the Phoenix generator. As far as I know, there’s no Phoenix-related downside to replacing Tailwind with something else, if there’s something else that you or the front-end dev prefers.

As far as tips, I’d suggest:

  1. Set up auto-deployment to a preview environment to make it easy for both of you to see changes.

  2. Write a lot of UI tests (which of course are super fast with LiveView because there’s no need to involve a web browser).

  3. Use separate identifying attributes in your DOM nodes for different uses. That way, the two of you will be less likely to interfere with each others’ domains (front-end vs back-end). I reserve id and class attributes for CSS (even if you are using Tailwind, you might want to throw in an ID or class here and there), data-* attributes for JavaScript (even if you think you’ll only be using LiveView, you might need to have a little JavaScript eventually), and test-* attributes for tests for find DOM nodes (I mostly use test-role and test-id attributes for my testing).

chrismccord

chrismccord

Creator of Phoenix

Just to be clear, that post refers to integrating the feedback styling to all of bootstraps specific form input styles, but this is the only css rule you need to get basic showing/hiding of validations (it’s what we generated in the app.css of Phoenix 1.6 apps for example):

/* LiveView specific classes for your customization */
.phx-no-feedback.invalid-feedback,
.phx-no-feedback .invalid-feedback {
  display: none;
}

Then any container with the invalid-feedback class (or whatever you want to call it) would be hidden until the input is interacted with.

Where Next?

Popular in Questions Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
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
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
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
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement