Sha256: 2568345c36d45294290995006e1884d51fc0f137edbfe4b9e69f0f89152542d0
Contents?: true
Size: 818 Bytes
Versions: 1
Compression:
Stored size: 818 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.assets_manifest end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
premailer-rails-1.10.1 | lib/premailer/rails/css_loaders/asset_pipeline_loader.rb |