This is sample repo for test integration with turbolinks.
To start your Phoenix app:
- Install dependencies with
mix deps.get
- Create and migrate your database with
mix ecto.create && mix ecto.migrate
- Seed data
mix run priv/repo/seeds.exs
- Install Node.js dependencies with
npm install
- Start Phoenix endpoint with
mix phoenix.server
Now you can visit localhost:4000
from your browser.
#Add to existing Phoenix Application:
npm install --save turbolinks
- Add turbolinks as brunch dependency in
brunch-config.js
innpm
section.
npm: {
enabled: true,
// Whitelist the npm deps to be pulled in as front-end assets.
// All other deps in package.json will be excluded from the bundle.
whitelist: ["phoenix", "phoenix_html", "turbolinks"]
}
- Import turbolinks in
web/static/assets/js/app.js
.
...
// Import dependencies
//
// If you no longer want to use a dependency, remember
// to also remove its path from "config.paths.watched".
import "phoenix_html"
import "turbolinks"
...