Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
December 16, 2021 05:08 pm GMT

Rails 7, The Shinning Star We've been waiting for

Over the last few weeks, DHH and the Rails core team have announced a number of different JavaScript build tools for use with Rails 7. As I was writing this very post, DHH wrote his own post outlining the strategy for Rails 7 and JavaScript. There is no doubt that Ruby on Rails fans were eagerly awaiting the release of Rails 7, and its numerous new features and updates. One of the most notable new features included in Rails 7 is Hotwire; modern and dynamic web applications can be built using this approach without having to write any JavaScript.

Rails 7 offers different of ways to interact client-side code from a Rails app:

The classic asset pipeline route via Sprockets and manifest files still will work as far as I can tell, but I think you might want to look at a newer tool.

Webpacker is still under active development, and should release a new version more or less simultaneously with Rails 7. I definitely take from DHHs post, though, that Webpacker is soft-deprecated in favor of the JS Bundling approach.

Rails 7 will support JavaScript Bundling as of literally 10 minutes ago as I started this post. The JavaScript bundling tool uses the existing Yarn and package.
json tooling, but places the bundle into the asset pipeline. For you your bundling took you can use Webpack, esbuild, a webpack replacement that bills itself as An extremely fast JavaScript bundler, which I suppose is better than a merely fast one, or a slow one, or Rollup.
Rollup doesnt have a fancy marketing slogan, but its also a JavaScript module bundler.
The default Rails 7 tooling is called import maps", which is a browser tool that lets you map a logical name to a downloaded module directly in the browser without needing to do further bundling on the server for the browser, and a Rails wrapper to manage that mapping from your codes.
Finally, you can just use Rails as an API, and manage your client side code as a separate project using whatever tooling you want.

Hotwire, one of the most talked-about features of Rails 7, is without a doubt the greatest feature of the new release since it has gained attention both in the Rails community and in those of other programming languages


Original Link: https://dev.to/shayanholakouee/rails-7-the-shinning-star-weve-been-waiting-for-4npn

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To