TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

TailwindCSS JIT with arbitrary values

145 pointsby ccmcareyabout 4 years ago

24 comments

Yaboodabout 4 years ago
I’ve been using tailwindcss and tailwindui for our production platform (released), and our new website (in development) and couldn’t be happier. Once you get the hang of it, you’ll be able to build stuff very quickly. For our production platform, I have it running on top of Angular and Angular material. Getting tailwind, angular, and material to work together wasn’t easy, but once I got it up and running, it was pretty straightforward to start building new pages or modify existing ones without having to change existing styles.<p>I had two major complaints and this update fixes both. The first is the enormous size of the css file locally, which caused the browser to become considerably slower and made the developer tools really slow to load when selecting elements. The second was the lack of the !important selector.<p>This is a solid update. Kudos to the team.
评论 #26736628 未加载
评论 #26735891 未加载
评论 #26735877 未加载
franklytabout 4 years ago
I still don’t get the tailwind hype. To me, I think the relevant parties are invested, myself included. CSS is weird and has had a lot of “answers” appended to it out of desperation, but I’ve been feeling really good about styled-components and&#x2F;or SASS modules, probably slightly in favor of the former, using file based code splitting. I’ve seen the explanations countless times, but if you were to ask me to advocate for tailwind right now, I’d find it difficult to highlight the advantages. The answers don’t immediately jump out at me, the problem we’re solving doesn’t seem immediately apparent, so I have trouble advocating for or understanding the tech. “You can build stuff quickly!” - doesn’t this just sound like someone comfortable with raw CSS? “You don’t need to context-switch!” - these are shorthand classes, not JS or JSX. The language isn’t uniform here.<p>Note: I’ve written a lot of CSS and generally prefer rolling my own components to using a library... perhaps I’m not the target audience. Perhaps this is a cherry flavor to make the “designing your own UI” medicine go down more easily. Perhaps I’m mistaken and not being charitable enough, too.
评论 #26736128 未加载
评论 #26736097 未加载
评论 #26737194 未加载
评论 #26735872 未加载
评论 #26735923 未加载
评论 #26742522 未加载
评论 #26739045 未加载
jerrygoyalabout 4 years ago
I tried JIT mode, loved its features like arbitrary styles, but eventually I switched back to default tailwind config.<p>So, when you use JIT you no longer get all tailwind classes in chrome dev tools only the ones you applied to components. I know it&#x27;s by design to keep css lightweight. But that also means I can no longer design UI using Chrome dev tools. Only when I apply tw classes directly to component in editor like vscode it reflects the change in browser. this back and forth cycle between editor and chrome took the fun away from me :(
评论 #26733368 未加载
mgkimsalabout 4 years ago
I&#x27;ve posted before, but will throw this out again.<p>When I&#x27;m building, I&#x27;m typically using a toolkit like vuetify or bootstrapvue. These are dozens of components - tested, documented, expanded on, and styled (using bootstrap or material design or... whatever).<p>The &#x27;just to go tailwind!&#x27; I keep seeing seems to assume I want to rebuild components (and then test them) which already exist, and are designed to work together. The common refrain is &quot;but all those sites look the same!&quot; but... I can change colors, sizes, and... when needed, a bit more, by going in to the scss (or similar) and recompiling.<p>I understand the &#x27;purge&#x27; stuff in tailwind is nice and useful (tested it firsthand) but the time&#x2F;effort of rebuilding large sets of components (which are, often, by and large commodity things) is so far a hard sell for me. I was on a team last year that was in their second round of developing their own in-house UI toolkit - basically recreating most of bootstrap-react, but poorly, and with no testing or accessibility, because &quot;bootstrap is bad&quot;. They were so far behind they thought they were ahead...<p>I&#x27;m just not grokking all the tailwind love. I&#x27;ve played with it, and yes... I guess <i>anything</i> that you learn and spend time with will, overtime, become &#x27;natural&#x27; and save you time.<p>It&#x27;s impressive tech, for sure - not trying to downplay it.
评论 #26731499 未加载
评论 #26731387 未加载
评论 #26736093 未加载
评论 #26735736 未加载
sb8244about 4 years ago
The big advantage of tailwind for me is that it solves responsive design better than any system I&#x27;ve used before. I&#x27;m not amazing at frontend styling (I get by), but I feel like a superhero with tailwind css and UI (worth the money)
评论 #26736637 未加载
评论 #26731780 未加载
lhorieabout 4 years ago
I may just be being pedantic here, but isn&#x27;t this AOT rather than JIT? JIT means the optimizer is code that ships as part of the runtime, which is sort of the opposite of what this does.
评论 #26731816 未加载
评论 #26731471 未加载
sam_goodyabout 4 years ago
Small companies have too many rough edges.<p>Large companies have too much baggage - fear of breaking compatibility, and don&#x27;t develop new enough things.<p>There is a certain size where changes are exciting, or certain company cultures that encourage new stuff. Tailwind is there, and it is always fun to get their update emails.
halfmatthalfcatabout 4 years ago
I used tailwind for v1 of my marketing site and it seemed fine at the time. Fast forward to when I needed to make some changes and some tags had 10+ modifiers on them including custom ones...it become so hard to figure out what was doing what without massively breaking things. I&#x27;ve since moved back to component libraries for their simplicity.
评论 #26732661 未加载
yowlingcatabout 4 years ago
Love Tailwind. It delivered on the promise of what I always wanted Bootstrap to be. Most notably, the `@apply` directive making it possible for me to refactor out my tailwind utility classes that I prototype with means that I can move fast and not end up with an eventual mess.<p>I&#x27;ll echo other folks who have said that using Tailwind has significantly increased how quickly I can put together frontend stuff -- it&#x27;s close to a 5x speedup for me workflow wise.
sakopovabout 4 years ago
Good god, JIT for CSS... I thought this was one of those joke articles about insane complexity of front-end development.
评论 #26731352 未加载
评论 #26736137 未加载
评论 #26735965 未加载
评论 #26736210 未加载
davzieabout 4 years ago
I was once a massive Tailwind hater. I remember walking around Ipswich with a close friend who is also a developer proverbially slagging it off and all those that espoused it as the next best thing since sliced bread. Then I actually thought “well I’d better jump on this bandwagon before I’m unemployable”. I’ve never been able to build stuff so fast. I’m absolutely floored by the small learning curve and the speed at which I can put things together, especially with the help of TailwindUI too. There’s something huge to be said about the fact that I don’t need to context switch to CSS-land out of my markup to style up what I’m doing. I didn’t realise it, but that overhead of switching to a style sheet and going back to modify markup and then viewing the results in the browser really just used up my mental energy battery. Now, if I was in prison with Adam Wathan and Steve S, I’d 100% protect them in the showers if they dropped the soap.
评论 #26731067 未加载
评论 #26731521 未加载
评论 #26731618 未加载
评论 #26731584 未加载
评论 #26732266 未加载
评论 #26732968 未加载
评论 #26731186 未加载
评论 #26730980 未加载
评论 #26731909 未加载
NiceWayToDoITabout 4 years ago
I just ducked all that, and started writing a plain old CSS with BEM like a mad man, and know what with a bit of discipline and good methodology it works as magic.
评论 #26731519 未加载
stephenabout 4 years ago
Don&#x27;t want to take away from Tailwind, it&#x27;s great.<p>That said, self-promotion disclaimer but if you like inline&#x2F;utility CSS, and also like TypeScript&#x2F;React&#x2F;Emotion, we&#x27;ve got a &quot;Tailwinds-ish&quot; CSS-in-JS library that we&#x27;ve enjoyed so far:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;homebound-team&#x2F;truss" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;homebound-team&#x2F;truss</a><p>Would love to have people try it out.
评论 #26732242 未加载
Kaze404about 4 years ago
I love TailwindCSS, and this just made it better than I wished for. It was always annoying having to use style attributes for specific, one-off things and it&#x27;s great knowing that it won&#x27;t be a problem anymore. Not to mention of course the performance improvements.<p>Can&#x27;t wait to upgrade Tailwind on my project and try this out :)
encodererabout 4 years ago
Tailwind: Your HTML will look terrible, but your website will look great.
评论 #26732091 未加载
评论 #26736001 未加载
nojvekabout 4 years ago
I am really a huge fan of esbuild. I know evanw is working on implementing css module support that has the same tree shaking ability as the js bits. This means the bundler only ships the css that is actually used.<p>I feel tailwind is somewhat going down that path, but I wonder if this is a problem that a bundler can solve.<p>I use tailwind with tsx react components and it seems the tailwind just-in-time mode won&#x27;t work with that.
Vuskaabout 4 years ago
This is something of an aside, but the design of Tailwind CSS classes inadvertently (or perhaps not) makes developing custom user styles nearly impossible.<p>When Laravel refreshed its documentation design, I wrote a stylesheet to revert it almost entirely to the old design. I could do it because restyling something like `.sidebar` is super simple. The new class list is<p><pre><code> fixed top-0 bottom-0 left-0 z-20 h-full w-16 flex flex-col bg-gradient-to-b from-gray-100 to-white transition-all duration-300 overflow-hidden lg:sticky lg:w-80 lg:flex-shrink-0 lg:flex lg:justify-end lg:items-end 2xl:max-w-lg 2xl:w-full </code></pre> And that is much harder to maintain in a user style.
canyoneroabout 4 years ago
Kudos to the team on the release. I&#x27;m a huge fan of allowing CSS via arbitrary class names. I work on team that is in the midst of migrating a large codebase away from custom global CSS (with BEM) to Tailwind. We frequently have to augment our tailwind.config.js file by adding one-off settings and that has always felt wrong. This should solve that pain point.<p>One area I&#x27;d love to see Tailwind tackle is better targeting for child elements. I understand the library is functional and the classes are atomic, but I think being able to chain and target arbitrary children elements would be quite powerful.
nikisweetingabout 4 years ago
Can someone clarify for an old school CSS person is confused (me). What is the point of doing this:<p><pre><code> &lt;div class=&quot;md:top-[-113px]&quot;&gt; </code></pre> Instead of this:<p><pre><code> &lt;div class=&quot;md&quot; style=&quot;top: -113px&quot;&gt; </code></pre> Why would you want to inline your overrides directly in the class names instead of just using style?
评论 #26735518 未加载
评论 #26737478 未加载
gvkhnaabout 4 years ago
Tailwind is great but the horizontal alignment of all classes is definitely not ideal.<p>Is there a vscode extension that possibly aligns classes in new lines? Alphabetical sorting could be nice as well.<p>Is this on the horizon for the Tailwind team? The intellisense extension is quite good so it’s possible this is a problem they are working on as well.
评论 #26729733 未加载
评论 #26759563 未加载
评论 #26733552 未加载
idkwhoiamabout 4 years ago
Utility css frameworks seem to boost productivity but was that ever a problem? IMO the big problem with CSS is maintainability. I was all hype about Tailwind CSS until I had to go back to a project and make adjustments. This soup of CSS classes is no better than a long regexp.
nickjjabout 4 years ago
If anyone is looking for practical examples of using Tailwind + the JIT compiler with various web frameworks and Webpack, I have a few example starter projects at:<p>- <a href="https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-flask-example" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-flask-example</a><p>- <a href="https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-django-example" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-django-example</a><p>- <a href="https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-node-example" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-node-example</a>
jackconsidineabout 4 years ago
I found out about TailwindCSS from the Full Stack Radio podcast, hosted by Tailwind&#x27;s creator. Good for Adam Wathan.<p>Unfortunately, the podcast hasn&#x27;t been kept up in the past few months. I assume TailWind is taking all of Adam&#x27;s time now?
评论 #26732539 未加载
WORMS_EAT_WORMSabout 4 years ago
This is literally an inline CSS shorthand language now and I love it.
评论 #26732277 未加载