class Astro::Middleware::Sprockets

Public Class Methods

new( app ) click to toggle source
# File lib/astro/middleware/sprockets.rb, line 7
def initialize( app )
  @app = app
end

Public Instance Methods

call( env ) click to toggle source

Creates a new sprockets environment instance and adds an anonymous preprocessor to require dependencies from the ‘astro.assets` array.

# File lib/astro/middleware/sprockets.rb, line 15
def call( env )
  sprockets = ::Sprockets::Environment.new
  sprockets.append_path 'lib/assets/javascripts'
  sprockets.append_path 'lib/assets/stylesheets'

  env[ 'astro.sprockets' ] = sprockets

  @app.call env
end