Module: Roadie

Defined in:
lib/roadie.rb,
lib/roadie/inliner.rb,
lib/roadie/version.rb,
lib/roadie/style_declaration.rb,
lib/roadie/css_file_not_found.rb,
lib/roadie/action_mailer_extensions.rb

Defined Under Namespace

Modules: ActionMailerExtensions Classes: CSSFileNotFound, Inliner, StyleDeclaration

Constant Summary collapse

VERSION =
'1.1.2'

Class Method Summary collapse

Class Method Details

.inline_css(*args) ⇒ Object

Shortcut for inlining CSS using Inliner

See Also:



4
5
6
# File 'lib/roadie.rb', line 4

def self.inline_css(*args)
  Roadie::Inliner.new(*args).execute
end

.load_css(root, targets) ⇒ String

Tries to load the CSS “names” specified in the targets parameter inside the root path.

Examples:

Roadie.load_css(Rails.root, %w[application newsletter])

Parameters:

  • root (Pathname)

    The root path of your stylesheets

  • targets (Array<String, Symbol>)

    Stylesheet names - without extensions

Returns:

  • (String)

    The combined contents of the CSS files

Raises:

  • (CSSFileNotFound)

    When a target cannot be found under [root]/[target].css



17
18
19
20
21
22
# File 'lib/roadie.rb', line 17

def self.load_css(root, targets)
  css_files_from_targets(root, targets).map do |file|
    raise CSSFileNotFound, file unless file.exist?
    file.read
  end.join("\n")
end