・ Ruby: 2.5.7 Rails: 5.2.4 ・ Vagrant: 2.2.7 -VirtualBox: 6.1 ・ OS: macOS Catalina
Gem
Gemfile
#Comment out
# gem 'turbolinks', '~> 5'
Terminal
$ bundle update
Delete =
.
application.js
//Change before
//= require turbolinks
//After change
// require turbolinks
'data-turbolinks-track': Remove'reload'
.
slim:application.html.slim
/Change before
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
/After change
= stylesheet_link_tag 'application', media: 'all'
= javascript_include_tag 'application'
** ① For ~ .js
files **
~.js
$(document).on('turbolinks:load', function() {
//Processing that wants to disable turbolinks
});
** ② For ~ .coffee
files **
~.coffee
$(document).on 'turbolinks:load', ->
#Processing that wants to disable turbolinks
** ① When adding an attribute to link_to **
~html.slim
= link_to '', root_path, 'data-turbolinks': false
** ② When enclosing with a div **
~html.slim
div data-turbolinks='false'
= link_to '', root_path
Recommended Posts