5 ms·
As an occasional user the Rails experience has suffered quite a lot over the years because the Javascript and CSS integration has become really unclear. The op
by oezi 2y ago
As an occasional user the Rails experience has suffered quite a lot over the years because the Javascript and CSS integration has become really unclear.
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?).
- masa331 2y agoI 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
- oezi 2y agoIf you don't use importmaps what do you use?
- masa331 2y agoWell 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
- mylons 2y agothe 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.
- oezi 2y agoAnd what do you use for CSS?
- ghiculescu 2y agoYou don’t need to “use” anything, browsers have very good CSS support these days.
- oezi 2y agoSure, 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.
- mylons 2y agothe 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.
- bitcoinofficial 2y agoRails 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.