Sha256: 657e1143ea16e343d345d717113d9bf76f18f68382859fbd0cb683112257baf2

Contents?: true

Size: 698 Bytes

Versions: 15

Compression:

Stored size: 698 Bytes

Contents

module Roadie
  # A provider that hooks into Rail's Asset Pipeline.
  #
  # Usage:
  #   config.roadie.provider = AssetPipelineProvider.new('prefix')
  #
  # @see http://guides.rubyonrails.org/asset_pipeline.html
  class AssetPipelineProvider < AssetProvider
    # Looks up the file with the given name in the asset pipeline
    #
    # @return [String] contents of the file
    def find(name)
      asset_file(name).to_s.strip
    end

    private
      def assets
        Roadie.app.assets
      end

      def asset_file(name)
        basename = remove_prefix(name)
        assets[basename].tap do |file|
          raise CSSFileNotFound.new(basename) unless file
        end
      end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
roadie-2.4.3 lib/roadie/asset_pipeline_provider.rb
md-roadie-2.4.2.md.1 lib/roadie/asset_pipeline_provider.rb
roadie-2.4.2 lib/roadie/asset_pipeline_provider.rb
roadie-2.4.1 lib/roadie/asset_pipeline_provider.rb
roadie-2.4.0 lib/roadie/asset_pipeline_provider.rb
roadie-2.3.4 lib/roadie/asset_pipeline_provider.rb
roadie-2.3.3 lib/roadie/asset_pipeline_provider.rb
roadie-2.3.2 lib/roadie/asset_pipeline_provider.rb
roadie-2.3.1 lib/roadie/asset_pipeline_provider.rb
roadie-2.3.0 lib/roadie/asset_pipeline_provider.rb
roadie-2.3.0.pre1 lib/roadie/asset_pipeline_provider.rb
roadie-2.2.0 lib/roadie/asset_pipeline_provider.rb
roadie-2.1.0 lib/roadie/asset_pipeline_provider.rb
roadie-2.1.0.pre2 lib/roadie/asset_pipeline_provider.rb
roadie-2.1.0.pre1 lib/roadie/asset_pipeline_provider.rb