Re:Ruby on Rails continues to thrive
by bitcoinofficial on Saturday September 21, 2024 @03:34AM
(#41608232)
Rails offers a choice of: webpack, esbuild, rollup, bun (since Rails v.7.1 I believe) and importmaps (default).
At least 5 built-in ways of doing JavaScript. And there are many more outside that, of course. None of these is Rails' "fault". That's the world of JavaScript, how it is.
As for the assets - Sprockets or Propshaft. The latter will replace Sprockets in new Rails versions.
the path forward is clear, and it’s no build/importmap based. i just overhauled a 15 year old rails project from rails 4 to 7, and ruby 2 to 3. ripping out webpack reduced deploy time by 90%
the complexity of the app is greatly reduced as a result.
And what do you use for CSS?
Re:Ruby on Rails continues to thrive
by ghiculescu on Saturday September 21, 2024 @03:57AM
(#41608357)
You don’t need to “use” anything, browsers have very good CSS support these days.
Sure, but you don't want to import CSS Franeworks as precomiled files, don't you? You would like to use them in their packaging system. This seems to be more js-centric today, still lots of SASS.
the project had some sass i didn’t want to port back to css. i’m using dartsass to compile it to css which is a recommendation in the rails guide.
I develop a lot in Rails mostly as a single developer and and it's totally ok. With CSS and JS you can pick the approach you like and just stick with it. Importmaps(which i don't prefer myself btw) are the current default but it's very easy to use the older Asset Pipeline without any problems.
And frankly importmaps or the other possible aproaches are not so hard to understand. Any serious developer should be able to learn that. It's also not a Rails thing, it's just web
If you don't use importmaps what do you use?
Well i'm using importmaps on some projects but mostly i stick with Asset Pipeline and that is for new projects also. Over the years i iterated towards a setup which is very efficient and simple to use which is to have light JS dependencies and no JS frameworks. And when the need for complex client side arises i use Elm which is a joy to use once you get through the learning.
Also the Asset Pipeline stack is getting even lighter nowadays since with CSS nesting and other new features you can drop SASS completely
The options and combination are too many, the work to change something too great for the single developer. It is okay if you want to use Tailwind or Bootstrap.
I confess I don't get what importmaps really do (how can they get rid of the need to precompile js assets?).