AstonJ

AstonJ

Curious whether there’s anyone here not using Tailwind - if you’re not, what are you using instead and was there any specific reason why you decided against Tailwind?

Showing Posts 88 to 79

theoldguy

theoldguy

There are two main approaches when working with styles. The first is designing directly in HTML, which is primarily used for quick prototyping. This involves using the style=“” attribute. Tailwind CSS is an extension of this approach.

The second approach is “design-first.” Using Sass (or a similar preprocessor) is very helpful here. You begin by writing a _variables.scss file, typically between 50-100 lines. It is best to define colors, etc semantically, such as $color-primary, rather than literally, like $color-gray. This allows you to change your entire color palette with minimal effort.

You will also create a _main.scss file for global styles and can start with something like _detail-page.scss for page-specific styling. When following a mobile-first methodology, you write the desktop styles directly within the same class, using media queries.

Ultimately, you’ll have around 10–20 style files, each approximately 50–100 lines. By using a tool like a monorepo alongside a development server such as Vite—which is perfect for this—you can design and test several sites with live reloading, all sharing a central design system.

Your template will then be robust and maintainable for 5–10 years with only minor updates. For each component, you’ll typically work with no more than 10 classes to consider. In projects with multiple developers, this approach makes it extremely straightforward to identify and correct any inconsistencies in design implementation.

woylie

woylie

  • tokens defined with Style Dictionary, exported to any needed format
  • map SASS variables (or mixins/functions depending on the use case) to CSS custom properties (allows you to spot the use of undefined custom properties at build time)
  • tokens use CTI naming
  • for colors, differentiate between base tokens (color-gray-400), semantic tokens (color-background-secondary; reference base tokens) and component tokens (color-button-background-primary-hover); see also Token naming section of the Design Token Color module
  • base color palettes can be generated or handpicked, but that’s up to the designer; I might do either for side projects
  • also check the Design Token Format module
  • utility classes generated from tokens
  • CSS classes
    • component classes: just the component name (e.g. `.box`)
    • component sub classes: always prefixed with the component name (e.g. `.box-body`)
    • modifier classes: `is-something`, `has-something`; CSS selectors must include component class (e.g. `.box.is-something {}` instead of just `.is-something {}`)
    • utility classes: {attribute}-{value} (e.g. `weight-medium`, `.bg-primary-normal`; value normally based on token names)
    • in practice, every component gets its own file, and everything is nested within the component class (`.box { > .box-header { &.is-cute {} }}`); stylelint ensures that certain attributes must be set via variables or functions (e.g. no hex colors, only color tokens)
  • maintenance cost and changing your mind later: all good, not sure what to say; SCSS is stable; in the end, you still write CSS with some niceties, so it would be trivial to refactor; the class conventions above are enough to prevent component styles from bleeding
  • technical side documented in the corresponding SCSS modules
  • token/color overview generated from Style Dictionary JSON output, rendered in Phoenix Storybook page

Tailwind does a lot of things that have already been figured out elsewhere, true :smiley:

egeersoz

egeersoz

AI is really good at these types of refactors because it can knock out the tedious and repetitive parts quite reliably. We just did a complete front end redesign (150k lines of Vue.js) using Opus 4.5. What would otherwise have taken us weeks took just three days, and that was mostly watching the AI work and then verifying the results.

eahanson

eahanson

SASS/SCSS variables

Usually I find a palette that I like. For no-nonsense apps I usually take the colors from Tabler.

My “public” variables are semantic, like: $control-color--contents--fg , $control-color--contents--bg etc., but they are defined using some “private” variables like $-blue, $-blue-lt, $-blue-dk etc.

I separate words with -- and prefix some classes with one-character prefixes like c for component and p for page. So c-control--button--xl for an extra-large button. My button component (in Web.Components.Control.button) has a size attr and the component sets the class like <a class={"c-control--button--#{@size}"}>. I could theoretically automatically generate the class names based on the component and function name, but I haven’t found the need to do that yet.

I never use utility classes. (Unless I’m using Tailwind or its predecessors, which I personally prefer not to do.)

I personally find it easier to edit SASS/SCSS than to edit a long list of utility class names.

I create a styleguide (which I think other people call a “storybook”?) that contains each component and its docs, as well as various examples. When I want to make a change to a component, I often view the changes in the styleguide so that I don’t forget to create examples of the various features of a component (kind of like test-driven development for components, except that there’s no automated feedback). The styleguide is just a single LiveView that has some navigation links to jump between components.

Schultzer

Schultzer

Here is a good resource https://moderncss.dev/

thomasbrus

thomasbrus

plain CSS and Sass

When I read this I always wonder…

  • how do you set up your token system (colors, font sizes, spacing)?
  • hand picked colors?
  • do you call a light gray $light-gray, $color-light-gray, or $color-gray-400. And so on.
  • CSS naming conventions for class names? BEM?
  • what about one-off styles, for example .text-right, max-sm:hidden? Do you have a utilities.sass file?
  • maintenance cost and changing your mind later
  • how do you document all these choices?

It feels to me you would end up doing a lot of the same things that Tailwind has already figured out. Or am I missing something, do tell let me know of course :slight_smile:

I agree about keeping HTML readable btw :grinning_face_with_smiling_eyes:

matt-savvy

matt-savvy

The good news is that you don’t need to use Tailwind with Phoenix! Let’s not throw the baby out with the bathwater here.

theoldguy

theoldguy

My own comfort zone is with plain CSS and Sass. I find their logic simple and the separation of concerns keeps my HTML tags shining and readable.

The component-focused paradigm just clicks for me. This preference is actually why I haven’t picked up Phoenix Framework in years, as its Tailwind integration doesn’t align with my style.

pepicrft

pepicrft

If you need a component kit native to Phoenix LiveView you can check out our build system Noora: Open sourcing Noora for the web

You can also see it live in our project at https://tuist.dev/tuist/tuist

@cschmatzler did and amazing job putting it together, and we are actively maintaining it and bringing new components regularly.

thomasbrus

thomasbrus

I think the argument regarding the utility class soup is also about:

  • what the markup looks like in the browser / inspect element
  • that when you open your component file, it is now littered with utility classes

It was like this in an earlier version of petal components but they switched to proper class names (I think also to make theming easier): petal_components/lib/petal_components/button.ex at v0.19.7 · petalframework/petal_components · GitHub

Where Next? Top

Trending in Discussions Top

budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
jtormey
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews