efficiently/turbolinks

This package is abandoned and no longer maintained. The author suggests using the frenzy/turbolinks package instead.

Frenzy Turbolinks makes following links in your web application faster with Laravel 5

dev-master 2015-03-30 08:23 UTC

README

In favor of the original repository Frenzy Turbolinks, who merged my changes 👍

Turbolinks for Laravel 4.1+

Turbolinks is a port of the Rails turbolinks and the jquery.turbolinks gems for projects using the PHP Laravel 4.1+ framework.

Versions

Current versions of the following JavaScript libraries are used:

  • turbolinks: v2.4.0
  • jquery.turbolinks: v2.1.0

For Laravel 5.0 supports see Turbolinks 1.0 branch

Performance

Turbolinks makes following links in your web application faster. Instead of letting the browser recompile the JavaScript and CSS between each page change, it keeps the current page instance alive and replaces only the body and the title in the head.

Performance improvements will vary depending on the amount of CSS and Javascript you are using. You can get up to a 2X increase when using a lot of Javascript and CSS. You can find the Rails benchmarks here.

Installation

Using Composer

Add the following in your composer.json:

{
    "require": {
        // ...
        "efficiently/turbolinks": "dev-master"
    }
}

Run this command in a terminal:

composer update efficiently/turbolinks

Add 'Efficiently\Turbolinks\TurbolinksServiceProvider', to the providers array in app/config/app.php after Larasset one (if you have installed this package).

With the Larasset package

If you have installed the Larasset package:

The turbolinks.js and jquery.turbolinks.js files will be added to the asset pipeline and available for you to use.

Add these lines in your app/assets/javascripts/application.js file, in this order:

//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//
// ... your other scripts here ...
//
//= require turbolinks

Then if the <head>section of your main layout.

<!DOCTYPE html>
<html lang="en">
    <head>
        <!-- ... -->
        {{ stylesheet_link_tag('application', ['data-turbolinks-track' => true]) }}
        {{ javascript_include_tag('application', ['data-turbolinks-track' => true]) }}
    </head>
    <!-- ... -->
</html>

Without the Larasset package (legacy method)

Click here to publish the assets manually.

Compatibility

The turbolinks javascript is designed to work with any browser that fully supports pushState and all the related APIs. This includes Safari 6.0+ (but not Safari 5.1.x!), IE10+, and latest Chrome and Firefox.

Do note that existing JavaScript libraries may not all be compatible with Turbolinks out of the box due to the change in instantiation cycle. You might very well have to modify them to work with Turbolinks' new set of events. For help with this, check out the Turbolinks Compatibility project.

Additional Resources

Please refer to the turbolinks and jquery.turbolinks projects if you require additional information on the javascript libraries and their usage.

Bugs

For bugs or feature requests, please create an issue.

Credits

This package is a fork of Frenzy Turbolinks repository.

Which is based on the Symfony middleware package Helthe Turbolinks.

Many thanks to them!