The HeltheTurbolinksBundle integrates the Helthe Turbolinks Component with your Symfony2 application.
Add the following in your composer.json
:
{
"require": {
// ...
"helthe/turbolinks-bundle": "~1.1"
}
}
$ composer require 'helthe/turbolinks-bundle=~1.1'
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Helthe\Bundle\TurbolinksBundle\HeltheTurbolinksBundle(),
);
}
{
"scripts": {
"post-install-cmd": [
"Helthe\\Bundle\\TurbolinksBundle\\Composer\\ScriptHandler::installAssets"
],
"post-update-cmd": [
"Helthe\\Bundle\\TurbolinksBundle\\Composer\\ScriptHandler::installAssets"
]
}
}
To start using turbolinks, all you need to do is add the turbolinks javascript to your layout.
Both the original coffeescript version and compiled version of each script are available for use.
<script src="{{ asset('bundles/heltheturbolinks/js/turbolinks.js') }}"></script>
{% javascripts '@HeltheTurbolinksBundle/Resources/public/js/turbolinks.js' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
If you need to use jquery.turbolinks, you need to add it before turbolinks.js
Turbolinks 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 Chromes and Firefoxes.
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.
Please refer to the turbolinks and jquery.turbolinks projects if you require additional information on the javascript libraries.
You will find additional documentation with the turbolinks component documentation.
For bugs or feature requests, please create an issue.