I'm just not sure how to add the javascript and CSS in when the gem I'm using hasn't been updated to use Webpack. I really like this tree view gem, the_sortable_tree, however, I haven't been able to get it to work in Rails 6 because it hasn't been updated. I'm happy to work on getting it up-to-date personally, but I'm not a master of how Ruby gems work--especially now with Webpack(er) in the mix. Anyhow, any ideas on what I need to do in order to leverage both the Rails 6 way of doing things and importing legacy gem code into my Rails 6 app?
In the documentation for the_sortable_tree, it says to add these to your application.js file:
//= require jquery
//= require jquery-ui
//= require jquery_ujs
But I have already added those using yarn so I think they should be good to go.
Then the docs say to add this code for the sortable tree UI:
//= require the_sortable_tree/jquery.ui.nestedSortable
//= require the_sortable_tree/sortable_ui/base
// with Turbolinks
$ ->
TheSortableTree.SortableUI.init()
// with Turbolinks
$(document).on "ready page:load", ->
TheSortableTree.SortableUI.init()
Is there a one-to-one translation for this? Or do the changes that are needed have to be implemented by the gem developer/creator?
How about the CSS? The docs say to add this to application.css:
*= require tree
*= require sortable_tree
*= require nested_options
*= the_sortable_tree/sortable_ui/base
So is there an equivalent in Rails 6? The paths here don't seem to be accessible.
Any help you can provide would be greatly appreciated. If I'm out of luck using this gem, so be it, but I just want to wrap my head around how this all works in general since Webpack(er) seems like such a departure from the old way of doing things that many gems seem to still employ.
Thanks.