tadasajon
Why am I only now learning about Milligram? It is included by default! Why the Tailwind hype?
So I spent a good bit of time getting Tailwind working and then learning how to do every little thing with Tailwind – I did this because everyone using Phoenix seems to think it is fantastic. I liked Tailwind when I was reading about it from a theoretical perspective, but in terms of actually using it… well, it seems like I just want something faster and easier and less verbose. I can barely tell the value of Tailwind over just using inline styles.
Then I discovered that Milligram is automatically included when you make a new Phoenix app – right there in assets/css/phoenix.css. From what I can tell so far it is just a super-lightweight version of Bootstrap, which is basically exactly what I need to get going fast.
I’m astonished that people aren’t talking about how it is even faster to just get going with Milligram, which is included by default. The docs don’t seem to mention it – or at least I haven’t come across it anywhere. It would have been super-nice if I’d been tipped off re: Milligram a month ago, when I started my project.
More info at Milligram.io for those who are interested – you don’t even have to install it to get started with it – just don’t delete it!
Most Liked
stefanchrobot
This is not true for me. I’m not in the business of building frameworks and I find Tailwind really better. If CSS is the assembler, then Tailwind is the C programming language. At the end of the day you still work with the same box model, etc, but it makes me go faster. I find myself looking at the Tailwind docs even if I’m not using Tailwind - truncate would be a great example.
The other benefit of Tailwind is that it’s bringing a design system with it. So no more figuring out the px size of a font (“infinite” possibilites), just pick one of xs, sm, base, lg, xl, 2xl, etc. Same goes for colors. A tip from their Rafactoring UI book - consider building your app in grayscale and only add color later. Again, Tailwind brings 10 shades of gray, and by limiting options makes things easier.
The moment when I fell in love with Tailwind was when I was able to recreate a designer-made modal dialog from their book in the Tailwind playground in minutes, which was a feat considering my limited CSS skills. It felt like Tailwind gave me superpowers. Of course the modal in the book was made using the same design system that is embedded into Tailwind, but my previous statement still holds true.
LostKobrakai
That’s a really great analogy. Tailwind is neither “do it all manually” aka in plain css, nor is is a component library like bootstrap, which supplies styling for html element + custom component.
The issue with plain css is how hard it is to get right, which imo includes the flexibility to adjust to (continuous) change in a project. Also it might look like inline styles are close to tailwind, but it couldn’t be different.
Frameworks like bootstrap are great if you want to hit the ground running and it provides everything you need, but boy is it a pain to extend or use for non supported components. Milligram also sits in that space of styling html elements, but comes with less custom stuff.
Tailwind (as well as other utility css frameworks) sits in between those approaches. It abstracts common pains of plain css like reusability, constant context switching, sizing fragmentation, flexibility, … but the styling of html elements / components is up to the user of the framework. No need to fight the framework to let something look a certain way.
Which one is more useful imo depends on the goal
- Want to or need to be fully in charge how things look and are architected → Plain CSS
- Want to or need to be fully in charge how things look → Tailwind
- Looking for a neat looking set of predefined styling for html / components → Bootstrap/Milligram/Tailwind UI
- Looking for not just predefined components, but also sections or whole pages → Themes
This is a rough categorisation. Often tools sit in between those categories. E.g. latest bootstrap also has a few utility functions, but also there are bootstrap “themes”; Tailwind UI still has Tailwind beneigh;
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









