module Middleman::ApplicationInsights::Helpers

Public Instance Methods

application_insights_tag() click to toggle source
# File lib/middleman-application-insights/helpers.rb, line 5
def application_insights_tag
  render_script('applicationinsights.js.erb')
end

Private Instance Methods

render_script(template) click to toggle source
# File lib/middleman-application-insights/helpers.rb, line 11
def render_script(template)
  return nil if development? && !application_insights_settings.development

  @options = application_insights_settings
  file = File.join(File.dirname(__FILE__), template)
  content = ERB.new(File.read(file)).result(binding)
  content_tag(:script, content, type: 'text/javascript')
end