aboutsummaryrefslogtreecommitdiffstats
path: root/actiontext/lib/action_text/attachments/minification.rb
blob: edc8f876d6b74ab68bda4d176d1a29fbe034fd32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module ActionText
  module Attachments
    module Minification
      extend ActiveSupport::Concern

      class_methods do
        def fragment_by_minifying_attachments(content)
          Fragment.wrap(content).replace(ActionText::Attachment::SELECTOR) do |node|
            node.tap { |n| n.inner_html = "" }
          end
        end
      end
    end
  end
end