abartov / bybeconv

Project Ben-Yehuda's content management system.
https://benyehuda.org/
Other
10 stars 5 forks source link

Update project to use modern assets management system #309

Open damisul opened 7 months ago

damisul commented 7 months ago

Our project still uses sprockets for managing js/css assets. Actually we even use pretty old version sprockets, as we have in gemfile:

gem 'sprockets', '~> 3' # 4.x requires switching to a manifest.js for assets

While this is mature and well-known approach, Rails has deprecated it in Rails 5 and it was not updated for years. Initially they switched to webpacker gem, but as far as I see currenly they proposes two main alternatives: jsbundling (https://github.com/rails/jsbundling-rails we used it in Sara project) and Importmap (https://github.com/rails/importmap-rails)

I'd propose to invest some time in switching to more modern framework, it will make it easier to use other modern technologies like React we've discussed earlier.

abartov commented 7 months ago

Yes, I just had no reason to upgrade until now. I understand how sprockets work, and it's stable.

I haven't made time to understand either jsbundling or importmaps, and am concerned about site stability after switching.

But if you think it wouldn't be complicated (we don't have too many assets and don't have any fancy custom steps), and is necessary for experimenting with React, go ahead and experiment in a branch and see if it's a reasonable time investment. If it is, I'll test it thoroughly, and if it works well, we'll switch.

damisul commented 6 months ago

Ok, I think importmaps will be easier-to-understand approach and it is default approach in modern Rails (they still use sprockets for css and importmaps for js).

As a first step towards this let's update sprocket we use from 3.x to 4+. There is a PR for this: https://github.com/abartov/bybeconv/pull/323