Turbolinks partial replacement

The application we have just built together does not use static assets, but it’s worth mentioning how to handle them with Webpacker. Suppose, you want to handle images. First, you need to decide where to put them: either group them in the  images folder under your frontend or place each image under the component responsible for putting it on screen. Whatever you decide, all your images need to find their way into Webpack manifest by being import ‘ed into javascripts that are ultimately included in your entry point.

Rails developers are usually pretty lazy when it comes to Javascript (although, most developers are pretty lazy). JQuery waits for DOMContentLoaded to fire before handing off execution to the function in ready . But Turbolinks takes DOMContentLoaded away from us, and gives us a couple other events instead . Try attaching events to these instead, or using JQuery’s .on to attach event handlers to the document (as opposed to individual nodes). This removal of the load and DOMContentLoaded events can wreak havoc on existing Javascript that uses page ready listeners everywhere, and why I wouldn’t recommend using Turbolinks on existing projects, and using it for greenfield only.

Turbolinks partial replacement

turbolinks partial replacement

Media:

turbolinks partial replacementturbolinks partial replacementturbolinks partial replacementturbolinks partial replacementturbolinks partial replacement