From 9273b5f7947c631e4961996977254acefe6a4430 Mon Sep 17 00:00:00 2001 From: Jeff Escalante Date: Thu, 19 Apr 2018 18:07:52 -0400 Subject: [PATCH] turbolinks and script optimizations --- .../source/assets/javascripts/analytics.js | 4 ++- website/source/layouts/layout.erb | 33 +++++-------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/website/source/assets/javascripts/analytics.js b/website/source/assets/javascripts/analytics.js index c9e0d801a..e565c5417 100644 --- a/website/source/assets/javascripts/analytics.js +++ b/website/source/assets/javascripts/analytics.js @@ -1,4 +1,6 @@ -document.addEventListener('DOMContentLoaded', function() { +document.addEventListener('turbolinks:load', function() { + analytics.page() + track('.downloads .download .details li a', function(el) { var m = el.href.match(/vagrant_(.*?)_(.*?)_(.*?)\.zip/) return { diff --git a/website/source/layouts/layout.erb b/website/source/layouts/layout.erb index 5926471d3..5e0120a88 100644 --- a/website/source/layouts/layout.erb +++ b/website/source/layouts/layout.erb @@ -27,16 +27,18 @@ <%= title_for(current_page) %> + + <%= stylesheet_link_tag "application" %> - - <%= javascript_include_tag "application" %> + + + <%= javascript_include_tag "application", defer: true %> - - - + + <%= yield_content :head %> @@ -113,23 +115,6 @@ - -