Method: BootstrapEmail::Compiler#initialize

Defined in:
lib/bootstrap-email/compiler.rb

#initialize(input, type: :string, options: {}) ⇒ Compiler

Returns a new instance of Compiler.

[View source]

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bootstrap-email/compiler.rb', line 5

def initialize(input, type: :string, options: {})
  BootstrapEmail.load_options(options)
  self.type = type
  case type
  when :rails
    @mail = input
    html = (@mail.html_part || @mail).body.raw_source
  when :string
    html = input
  when :file
    html = File.read(input)
  end
  html = add_layout!(html)
  sass_load_paths
  build_premailer_doc(html)
end