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.

Rails 6 with Webpacker 6, Tailwind 2 with JIT, Postcss 8 and some default setup

169 pointsby naumanalmost 4 years ago

13 comments

toberonialmost 4 years ago
It&#x27;s telling that most instructions deal with the Javascript toolchain and not Rails itself. And let&#x27;s hope that everything works and none of the 2000 imported node_modules blow up when this tutorial is 3 months old.<p>I&#x27;m looking forward to Phoenix 1.6 which ditches Webpack for esbuild. Every step away from the insane churn of the modern frontend world is welcome.
评论 #28190255 未加载
评论 #28189907 未加载
评论 #28189824 未加载
评论 #28190192 未加载
评论 #28189960 未加载
评论 #28192304 未加载
评论 #28189461 未加载
评论 #28189235 未加载
评论 #28190397 未加载
评论 #28189309 未加载
评论 #28189482 未加载
评论 #28189713 未加载
评论 #28192480 未加载
评论 #28189281 未加载
adamwathanalmost 4 years ago
Creator of Tailwind here — if you don’t want to go deep into JS tooling and really just care about spitting out a CSS file, it&#x27;s a lot simpler to just use our CLI tool: <a href="https:&#x2F;&#x2F;tailwindcss.com&#x2F;docs&#x2F;installation#using-tailwind-cli" rel="nofollow">https:&#x2F;&#x2F;tailwindcss.com&#x2F;docs&#x2F;installation#using-tailwind-cli</a>
评论 #28192407 未加载
评论 #28195307 未加载
评论 #28192397 未加载
评论 #28192323 未加载
petepetealmost 4 years ago
I do kind of wish Rails had just taken the &#x27;bring your own JavaScript and CSS&#x27; route instead of wrapping Webpack and adding a boatload of confusion due to multiple layers of things that don&#x27;t feel like they were designed to work together.<p>Tell me where to output my .js, .css and other assets and let me worry about compiling - or not as is often the case.
评论 #28190905 未加载
评论 #28190997 未加载
评论 #28190856 未加载
nickjjalmost 4 years ago
If anyone wants to see a working example of this in Docker, I have an example app at: <a href="https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-rails-example" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-rails-example</a><p>Besides Rails &#x2F; Webpacker 6 and Tailwind with the JIT compiler it also includes Sidekiq, Action Cable and Turbo along with Postgres and Redis.<p>I&#x27;m not married to the idea of Webpacker, but currently it&#x27;s the most painless way to create bundles and process your CSS and JS even if you mostly use server side templates with sprinkles of JS. I&#x27;ll switch the example app to what Rails defaults to in the future but right now we&#x27;re in a limbo state where combining a bunch of other independent watchers (esbuild + Tailwind&#x27;s watcher) and ESM isn&#x27;t a better development experience IMO.<p>With Webpacker and Tailwind&#x27;s JIT, CSS + JS changes take 100ms and you can further optimize startup times with using Webpack&#x27;s disk cache. With the above Docker set up it&#x27;s configured with multi-stage builds so your final Rails app only has the end result of running an assets precompile which only runs with RAILS_ENV=production. The Webpack watcher only runs in development too.<p>If anyone works with Phoenix instead, a similar example app is here <a href="https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-phoenix-example" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nickjj&#x2F;docker-phoenix-example</a>. There&#x27;s also example apps for Flask, Django, Node and Play too if you replace the name of the repo. All of them go over the motions of setting up a base line app with Tailwind and Webpack plus whatever else is idiomatic in that stack.<p><i>Plot twist:</i> For the Flask, Django, Phoenix, Node and Play examples I&#x27;ve used nearly the same Webpack config for 2 years and I continuously keep Webpack and all of the JS dependencies up to date. There hasn&#x27;t been any issues at all. I wouldn&#x27;t consider myself an advanced front-end developer either. I glanced their docs, found something that works and stuck with it.
pjm331almost 4 years ago
Love seeing the set of gems that folks tend to bring into all their projects. <a href="https:&#x2F;&#x2F;github.com&#x2F;dejan&#x2F;rails_panel" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dejan&#x2F;rails_panel</a> Was a new one for me, will def be checking that out
Aeolunalmost 4 years ago
Wait. So… you practically need to develop an app to start developing an app?<p>When someone tells me to ‘invoke these 3 magic incantations’, I can sort of keep track of it. But here it seems like the instructions are to invoke these 300 magic incantations.
评论 #28189173 未加载
评论 #28189387 未加载
评论 #28191645 未加载
paozacalmost 4 years ago
Useful recap. I went through something similar a few weeks ago and the webpack&#x2F;tailwindcss JIT&#x2F;postcss setup has been a pain in the ass: dependency hell, outdated documentation, unintelligible error messages.<p>I&#x27;m glad to see that both rails and phoenix guys are looking for a way out of this madness. The writing is on the wall.
评论 #28198553 未加载
boukalmost 4 years ago
I started work on a (webpacker-like) esbuild integration for Rails: <a href="https:&#x2F;&#x2F;github.com&#x2F;bouk&#x2F;esbuilder" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bouk&#x2F;esbuilder</a><p>It works, but needs UX work, documentation and more extensive testing to be appropriate for general use
thomasjklemmalmost 4 years ago
Using Vite with Ruby&#x2F;Rails is also a modern option [1], really impressed after trying it out.<p>The article &quot;A Rubyist&#x27;s Guide to Vite.js&quot;[2] from the author of ViteRuby provides a cool deep dive.<p>[1]: <a href="https:&#x2F;&#x2F;vite-ruby.netlify.app" rel="nofollow">https:&#x2F;&#x2F;vite-ruby.netlify.app</a><p>[2]: <a href="https:&#x2F;&#x2F;maximomussini.com&#x2F;posts&#x2F;a-rubyist-guide-to-vite-js&#x2F;" rel="nofollow">https:&#x2F;&#x2F;maximomussini.com&#x2F;posts&#x2F;a-rubyist-guide-to-vite-js&#x2F;</a>
评论 #28247705 未加载
cutleralmost 4 years ago
I think esbuild would have made webpack redundant soon if it hadn&#x27;t already been removed.
ramesh31almost 4 years ago
What is Webpacker?
评论 #28190222 未加载
chana_masalaalmost 4 years ago
There are enough instances of webpacker in this thread (instead of webpack) making me think it&#x27;s something different.
gjmacdalmost 4 years ago
Another reason to move to Elixir from Ruby...
评论 #28189625 未加载
评论 #28190555 未加载
评论 #28189477 未加载