From fba12aef24ff3388bb44a29df63e9e3496f8eb0a Mon Sep 17 00:00:00 2001 From: James Mason Date: Sun, 12 Nov 2017 20:43:02 -0800 Subject: [PATCH] Only include transifex JS if the ENV var is set ... otherwise, don't bother loading this blocking external resource. --- app/views/layouts/application.html.haml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index c1a6ce78..ee88a24c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -9,15 +9,16 @@ = javascript_include_tag "application" = csrf_meta_tags - :javascript - window.liveSettings = { - api_key: "#{ENV['OSEM_TRANSIFEX_APIKEY']}", - picker: "bottom-right", - detectlang: true, - autocollect: true - }; = content_for(:script_head) - = javascript_include_tag "//cdn.transifex.com/live.js" + - if ENV['OSEM_TRANSIFEX_APIKEY'] + :javascript + window.liveSettings = { + api_key: "#{ENV['OSEM_TRANSIFEX_APIKEY']}", + picker: "bottom-right", + detectlang: true, + autocollect: true + }; + = javascript_include_tag "//cdn.transifex.com/live.js" = yield(:head) %body