Sha256: 80688c256d9c2f119c140b3fbadc3a8ff2646306414050f86dd238e7e267f4c3

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module BootstrapEmail
  module Converter
    class AddMissingMetaTags < Base
      META_TAGS = [
        { query: 'meta[http-equiv="Content-Type"]',
          code: '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' },
        { query: 'meta[http-equiv="x-ua-compatible"]',
          code: '<meta http-equiv="x-ua-compatible" content="ie=edge">' },
        { query: 'meta[name="x-apple-disable-message-reformatting"]',
          code: '<meta name="x-apple-disable-message-reformatting">' },
        { query: 'meta[name="viewport"]',
          code: '<meta name="viewport" content="width=device-width, initial-scale=1">' },
        { query: 'meta[name="format-detection"]',
          code: '<meta name="format-detection" content="telephone=no, date=no, address=no, email=no">' }
      ].reverse.freeze

      def build
        META_TAGS.each do |tag_hash|
          doc.at_css('head').prepend_child(tag_hash[:code]) unless doc.at_css(tag_hash[:query])
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bootstrap-email-1.5.1 lib/bootstrap-email/converters/add_missing_meta_tags.rb
bootstrap-email-1.5.0 lib/bootstrap-email/converters/add_missing_meta_tags.rb
bootstrap-email-1.4.1 lib/bootstrap-email/converters/add_missing_meta_tags.rb
bootstrap-email-1.4.0 lib/bootstrap-email/converters/add_missing_meta_tags.rb
bootstrap-email-1.3.1 lib/bootstrap-email/converters/add_missing_meta_tags.rb
bootstrap-email-1.3.0 lib/bootstrap-email/converters/add_missing_meta_tags.rb
bootstrap-email-1.2.0 lib/bootstrap-email/converters/add_missing_meta_tags.rb
bootstrap-email-1.1.7 lib/bootstrap-email/converters/add_missing_meta_tags.rb
bootstrap-email-1.1.6 lib/bootstrap-email/converters/add_missing_meta_tags.rb
bootstrap-email-1.1.5 lib/bootstrap-email/converters/add_missing_meta_tags.rb