Sha256: 22297bb36966d8fb73666b049b5c57e90cb5efe5cbf95af8d798714142b6091e

Contents?: true

Size: 559 Bytes

Versions: 3

Compression:

Stored size: 559 Bytes

Contents

module BootstrapEmail
  module Component
    class Spacing < Base
      def build
        each_node('*[class*=space-y-]') do |node|
          spacer = node['class'].scan(/space-y-((lg-)?\d+)/)[0][0]
          # get all direct children except the first
          node.xpath('./*[position()>1] | ./tbody/tr/td/*[position()>1]').each do |child|
            html = ''
            html += template('div', classes: "s-#{spacer}", contents: nil)
            html += child.to_html
            child.replace(html)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bootstrap-email-1.0.0.alpha1.2 lib/bootstrap-email/components/spacing.rb
bootstrap-email-1.0.0.alpha1.1 lib/bootstrap-email/components/spacing.rb
bootstrap-email-1.0.0.alpha1 lib/bootstrap-email/components/spacing.rb