Sha256: 562dfa65b426f179093fc03bdddfa17bb16ba17f39a8cd3b32ba4cf7abb4eb3e
Contents?: true
Size: 910 Bytes
Versions: 1
Compression:
Stored size: 910 Bytes
Contents
# encoding: utf-8 require 'easy_html_generator/generator/compile/base' # this generator adds web tracking snippets to files in the dist folder class EasyHtmlGenerator::Generator::Service::Analytics < EasyHtmlGenerator::Generator::Compile::Base def do_input!(input, _input_file, _output_file, config) return if input.include? begin_marker(config) analytics_code = build_content(config) input.sub('</head>', "#{analytics_code}</head>") end def begin_marker(config) "<!-- #{config.name} Analytics -->" end def end_marker(config) "<!-- End #{config.name} Analytics -->" end def build_content(config) content = config.code config.params.each do |key, value| content.sub!("{#{key}}", value) end "#{begin_marker(config)} #{content} #{end_marker(config)}" end def watch_files(config) Dir[File.join(config.source, config.selector)] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
easy_html_generator-1.0.6 | lib/easy_html_generator/generator/service/analytics.rb |