- cd directory
- npm install
- install turbolink with npm
npm i turbolinks
- paste code here in resources/js/app.js
var Turbolinks = require("turbolinks");
if (Turbolinks.supported) {
Turbolinks.start();
}
- compaile mix js, waiting until compailed done
npm run watch
- paste inside
<head>
<script src="{{ mix('js/app.js') }}" defer></script>
</head>
- use this css for custom progress bar
.turbolinks-progress-bar {
height: 5px;
background-color: green;
}
- hidden progress bar
.turbolinks-progress-bar {
visibility: hidden;
}
- it's esay, Done!
- Usually turbolink will read tag automatically, if turbolink does not work, you can use this script to fix it
<a href="javascript:void(0)" onClick="Turbolinks.visit(location_url)" >
- Basically the turbolink speed is cached, but in some circumstances you may not need it, you can turn it off with
<meta name="turbolinks-cache-control" content="no-cache">
it's recommended