Sha256: 664ca3bbacb3bfaa15bb5b851a74ba26eca50573404393ac2620cb202d67e4e3

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

module Roadie
  # Shortcut for inlining CSS using {Inliner}
  # @see Inliner
  def self.inline_css(*args)
    Roadie::Inliner.new(*args).execute
  end

  # Shortcut to Rails.application.assets
  def self.assets
    Rails.application.assets
  end

  # Tries to load the CSS "names" specified in the +targets+ parameter using the Rails asset pipeline.
  #
  # @example
  #   Roadie.load_css(%w[application newsletter])
  #
  # @param [Array<String|Symbol>] targets Stylesheet names
  # @return [String] The combined contents of the CSS files
  # @raise [CSSFileNotFound] When a target cannot be found from Rails assets
  def self.load_css(targets)
    targets.map do |file|
      raise CSSFileNotFound, file unless assets[file]
      assets[file].to_s.strip
    end.join("\n")
  end
end

require 'roadie/version'
require 'roadie/css_file_not_found'
require 'roadie/style_declaration'
require 'roadie/inliner'

require 'action_mailer'
require 'roadie/action_mailer_extensions'

ActionMailer::Base.send :include, Roadie::ActionMailerExtensions

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roadie-2.0.0 lib/roadie.rb