mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Sass] Document Plugin::Rack.
This commit is contained in:
parent
43392a54dd
commit
5caec5341a
1 changed files with 31 additions and 0 deletions
|
@ -2,11 +2,42 @@ require 'sass/plugin'
|
||||||
|
|
||||||
module Sass
|
module Sass
|
||||||
module Plugin
|
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
|
class Rack
|
||||||
|
# Initialize the middleware.
|
||||||
|
#
|
||||||
|
# @param app [#call] The Rack application
|
||||||
def initialize(app)
|
def initialize(app)
|
||||||
@app = app
|
@app = app
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Process a request, checking the Sass stylesheets for changes
|
||||||
|
# and updating them if necessary.
|
||||||
|
#
|
||||||
|
# @param env The Rack request environment
|
||||||
|
# @return [(#to_i, Hash<String, String>, Object)] The Rack response
|
||||||
def call(env)
|
def call(env)
|
||||||
Sass::Plugin.check_for_updates
|
Sass::Plugin.check_for_updates
|
||||||
@app.call(env)
|
@app.call(env)
|
||||||
|
|
Loading…
Add table
Reference in a new issue