Sha256: 69548b6685a534707c7dc4ac2b0f8b58643b835d93f0bad26ebcf5fbe5fdce93
Contents?: true
Size: 907 Bytes
Versions: 3
Compression:
Stored size: 907 Bytes
Contents
class Premailer module Rails module CSSLoaders module AssetPipelineLoader extend self def load(url) return unless asset_pipeline_present? file = file_name(url) ::Rails.application.assets_manifest.find_sources(file).first rescue Errno::ENOENT, TypeError => _error end def file_name(url) prefix = [ ::Rails.configuration.relative_url_root, ::Rails.configuration.assets.prefix, '/' ].join URI(url).path .sub(/\A#{prefix}/, '') .sub(/-(\h{32}|\h{64})\.css\z/, '.css') end def asset_pipeline_present? defined?(::Rails) && ::Rails.application && ::Rails.application.respond_to?(:assets_manifest) && ::Rails.application.assets_manifest end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems