Sha256: ff4a2d56cdebfa5634d1bb2782e2f11ad398551d1040caa35bf645617252ba3e

Contents?: true

Size: 511 Bytes

Versions: 13

Compression:

Stored size: 511 Bytes

Contents

module Locomotive::Steam
  module Middlewares

    class DynamicAssets

      REGEXP = /^\/(javascripts|stylesheets)\/(.*)$/o

      attr_reader :app, :assets

      def initialize(app, options)
        @app    = app
        @assets = Locomotive::Steam::SprocketsEnvironment.new(options[:root], options)
      end

      def call(env)
        if env['PATH_INFO'] =~ REGEXP
          env['PATH_INFO'] = $2
          assets.call(env)
        else
          app.call(env)
        end
      end

    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
locomotivecms_steam-1.0.0.rc9 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.rc8 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.rc6 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.rc4 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.rc3 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.rc2 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.rc1 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.pre.beta.3 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.pre.beta.2 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.pre.beta.1 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.pre.alpha.3 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.pre.alpha.2 lib/locomotive/steam/middlewares/dynamic_assets.rb
locomotivecms_steam-1.0.0.pre.alpha.1 lib/locomotive/steam/middlewares/dynamic_assets.rb