sass 3.1.0.alpha.37 → 3.1.0.alpha.38
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/sass/plugin/rack.rb +15 -2
- metadata +1 -1
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0.alpha.
|
1
|
+
3.1.0.alpha.38
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0.alpha.
|
1
|
+
3.1.0.alpha.38
|
data/lib/sass/plugin/rack.rb
CHANGED
@@ -24,11 +24,21 @@ module Sass
|
|
24
24
|
# The locations and frequency {file:SASS_REFERENCE.md#options can be customized}.
|
25
25
|
# That's all there is to it!
|
26
26
|
class Rack
|
27
|
+
# The delay, in seconds, between update checks.
|
28
|
+
# Useful when many resources are requested for a single page.
|
29
|
+
# `nil` means no delay at all.
|
30
|
+
#
|
31
|
+
# @return [Float]
|
32
|
+
attr_accessor :dwell
|
33
|
+
|
27
34
|
# Initialize the middleware.
|
28
35
|
#
|
29
36
|
# @param app [#call] The Rack application
|
30
|
-
|
37
|
+
# @param dwell [Float] See \{#dwell}
|
38
|
+
def initialize(app, dwell = 1.0)
|
31
39
|
@app = app
|
40
|
+
@dwell = dwell
|
41
|
+
@check_after = Time.now.to_f
|
32
42
|
end
|
33
43
|
|
34
44
|
# Process a request, checking the Sass stylesheets for changes
|
@@ -37,7 +47,10 @@ module Sass
|
|
37
47
|
# @param env The Rack request environment
|
38
48
|
# @return [(#to_i, {String => String}, Object)] The Rack response
|
39
49
|
def call(env)
|
40
|
-
|
50
|
+
if @dwell.nil? || Time.now.to_f > @check_after
|
51
|
+
Sass::Plugin.check_for_updates
|
52
|
+
@check_after = Time.now.to_f + @dwell if @dwell
|
53
|
+
end
|
41
54
|
@app.call(env)
|
42
55
|
end
|
43
56
|
end
|