lib/bootstrap-email/converters/head_style.rb in bootstrap-email-1.1.7 vs lib/bootstrap-email/converters/head_style.rb in bootstrap-email-1.2.0

- old
+ new

@@ -1,11 +1,12 @@ # frozen_string_literal: true module BootstrapEmail module Converter class HeadStyle < Base - def build + def build(config) + @config = config doc.at_css('head').add_child(bootstrap_email_head) end private @@ -16,10 +17,10 @@ </style> HTML end def purged_css_from_head - default, custom = BootstrapEmail::SassCache.compile('bootstrap-head').split('/*! allow_purge_after */') + default, custom = BootstrapEmail::SassCache.compile('bootstrap-head', @config).split('/*! allow_purge_after */') # get each CSS declaration custom.scan(/\w*\.[\w\-]*[\s\S\n]+?(?=})}{1}/).each do |group| # get the first class for each comma separated CSS declaration exist = group.scan(/(\.[\w\-]*).*?((,+?)|{+?)/).map(&:first).uniq.any? do |selector| !doc.at_css(selector).nil?