mercredi 4 août 2021

Rails 6 upgrading from turbolinks to turbo. How to require turbo-rails in application.js?

I'm working on a legacy application, recently upgrades to Rails 6.0.4. The app uses sprockets, NOT webpacker.

Now I'm trying to move off of turbolinks and onto turbo-rails. The js files in this app all use sprockets require directives such as:

//= require jquery3
//= require turbolinks

I can't seem to figure out how to apply this to turbo-rails. I've installed the gem and removed turbolinks, but all of the documentation I've found has things like import "@hotwired/turbo-rails".

I'm not very knowledgeable about front end stuff, but I believe this is a different (ES6?) syntax. This app is currently on sprockets 3.7.2 and I don't think sprockets supports ES6 until version 4. I'd like to avoid this upgrade touching more dependencies if possible...

is it possible to //= require turbo in the same way I currently have //= require turbolinks?'




Aucun commentaire:

Enregistrer un commentaire