How to embed github gists with Turbolinks in Rails

Posted By: Dylan Hunt

Published: November 21, 2016 00:12


When I was making this website I almost chose not to use gists because they wouldn't load for me with turbolinks, but then I was able to find a solution that works every time, and hopefully it is still working and you can read this post.

1. Change the formatting of your gists from the before to the after shown below:

2. Add this coffee script to your applications main js file

Note the turbolinks load function, that ensures it reloads EVERY TIME, not just when the page fully reloads

3. Add this styling so they look identical and the spacing formats the way you want it to

That's it, you're ready to load your github gists while keeping turbolinks on your site, and they look nearly identical.


Need help implementing any of these guides?

Contact Me