Sha256: 76d2dcd030152d8b27133fbb5f0a95eb7e0228c5e6ab19868182a3cd13a0cea7

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

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

    # Shortcut to Rails.application
    def app
      Rails.application
    end

    # Returns all available providers
    def providers
      [AssetPipelineProvider, FilesystemProvider]
    end

    # Returns the value of +config.roadie.enabled+.
    #
    # Roadie will disable all processing if this config is set to +false+. If
    # you just want to disable CSS inlining without disabling the rest of
    # Roadie, pass +css: nil+ to the +defaults+ method inside your mailers.
    def enabled?
      config.roadie.enabled
    end

    # Returns the active provider
    #
    # If no provider has been configured a new provider will be instantiated
    # depending on if the asset pipeline is enabled or not.
    #
    # If +config.assets.enabled+ is +true+, the {AssetPipelineProvider} will be used
    # while {FilesystemProvider} will be used if it is set to +false+.
    #
    # @see AssetPipelineProvider
    # @see FilesystemProvider
    def current_provider
      return config.roadie.provider if config.roadie.provider

      if config.respond_to?(:assets) and config.assets and config.assets.enabled
        AssetPipelineProvider.new
      else
        FilesystemProvider.new
      end
    end

    private
      def config
        Roadie.app.config
      end
  end
end

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

require 'roadie/asset_provider'
require 'roadie/asset_pipeline_provider'
require 'roadie/filesystem_provider'

require 'roadie/inliner'

require 'roadie/railtie' if defined?(Rails)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roadie-2.3.4 lib/roadie.rb