Sha256: aafbea92590679feb4542f32439a22845524eb8ff650bd9700c12169db102d8a

Contents?: true

Size: 1.3 KB

Versions: 29

Compression:

Stored size: 1.3 KB

Contents

require 'sass/plugin'

module Sass
  module Plugin
    # Rack middleware for compiling Sass code.
    #
    # ## Activate
    #
    #     require 'sass/plugin/rack'
    #     use Sass::Plugin::Rack
    #
    # ## Customize
    #
    #     Sass::Plugin.options.merge(
    #       :cache_location => './tmp/sass-cache',
    #       :never_update => environment != :production,
    #       :full_exception => environment != :production)
    #
    # {file:SASS_REFERENCE.md#options See the Reference for more options}.
    #
    # ## Use
    #
    # Put your Sass files in `public/stylesheets/sass`.
    # Your CSS will be generated in `public/stylesheets`,
    # and regenerated every request if necessary.
    # The locations and frequency {file:SASS_REFERENCE.md#options can be customized}.
    # That's all there is to it!
    class Rack
      # Initialize the middleware.
      #
      # @param app [#call] The Rack application
      def initialize(app)
        @app = app
      end

      # Process a request, checking the Sass stylesheets for changes
      # and updating them if necessary.
      #
      # @param env The Rack request environment
      # @return [(#to_i, {String => String}, Object)] The Rack response
      def call(env)
        Sass::Plugin.check_for_updates
        @app.call(env)
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
haml-edge-2.3.235 lib/sass/plugin/rack.rb
haml-edge-2.3.234 lib/sass/plugin/rack.rb
haml-edge-2.3.233 lib/sass/plugin/rack.rb
haml-edge-2.3.230 lib/sass/plugin/rack.rb
haml-edge-2.3.229 lib/sass/plugin/rack.rb
haml-edge-2.3.228 lib/sass/plugin/rack.rb
haml-edge-2.3.227 lib/sass/plugin/rack.rb
haml-edge-2.3.226 lib/sass/plugin/rack.rb
haml-edge-2.3.225 lib/sass/plugin/rack.rb