rack-less 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +6 -0
- data/lib/rack/less.rb +5 -0
- data/lib/rack/less/config.rb +28 -3
- data/lib/rack/less/options.rb +1 -1
- data/lib/rack/less/version.rb +2 -2
- metadata +59 -29
data/README.rdoc
CHANGED
@@ -74,6 +74,12 @@ You should now see `Rack::Less` listed in the middleware pipeline:
|
|
74
74
|
* .*combinations* [{}]
|
75
75
|
- Directives for combining the output of many stylesheets and serving them as a single resource.
|
76
76
|
|
77
|
+
* .*combination_timestamp* [false]
|
78
|
+
- Directives for timestamping (cache-busting) while using combinations
|
79
|
+
- :*false* - don't explicitly add timestamps
|
80
|
+
- :*true* - add Time.now.to_i as the explicit timestamp (will never cache)
|
81
|
+
- :*<any other value>* - add the value as "foo.css?<value>" (use something like a File.mtime to cache-bust like Rails does)
|
82
|
+
|
77
83
|
=== Combinations
|
78
84
|
|
79
85
|
At times, it is useful to combine multiple stylesheets and serve them as one resource. For example you may have two sets of stylesheets: one for traditional web views and one for mobile web views. Rails' provides the :cache option on 'stylesheet_link_tag' helper to provide this function, ie:
|
data/lib/rack/less.rb
CHANGED
data/lib/rack/less/config.rb
CHANGED
@@ -21,15 +21,18 @@ module Rack::Less
|
|
21
21
|
# 'web' => ['reset', 'common', 'app_web'],
|
22
22
|
# 'mobile' => ['reset', 'iui', 'common', 'app_mobile']
|
23
23
|
# }
|
24
|
+
# :combination_timestamps
|
25
|
+
# whether to append a timestamp to the sheet requests generated by combinations
|
24
26
|
class Config
|
25
27
|
|
26
|
-
ATTRIBUTES = [:cache, :compress, :combinations]
|
28
|
+
ATTRIBUTES = [:cache, :compress, :combinations, :combination_timestamp]
|
27
29
|
attr_accessor *ATTRIBUTES
|
28
30
|
|
29
31
|
DEFAULTS = {
|
30
32
|
:cache => false,
|
31
33
|
:compress => false,
|
32
|
-
:combinations => {}
|
34
|
+
:combinations => {},
|
35
|
+
:combination_timestamp => false
|
33
36
|
}
|
34
37
|
|
35
38
|
def initialize(settings={})
|
@@ -50,9 +53,31 @@ module Rack::Less
|
|
50
53
|
if key.nil?
|
51
54
|
@combinations
|
52
55
|
else
|
53
|
-
cache?
|
56
|
+
if cache?
|
57
|
+
combo_filename(key)
|
58
|
+
else
|
59
|
+
(@combinations[key] || []).collect do |combo|
|
60
|
+
combo_filename(combo)
|
61
|
+
end
|
62
|
+
end
|
54
63
|
end
|
55
64
|
end
|
56
65
|
|
66
|
+
private
|
67
|
+
|
68
|
+
def combo_filename(combo)
|
69
|
+
filename = combo.strip
|
70
|
+
filename += ".css" unless filename.include?('.css')
|
71
|
+
if !filename.include?('?') && combination_timestamp
|
72
|
+
filename += "?"
|
73
|
+
filename += if combination_timestamp == true
|
74
|
+
Time.now.to_i
|
75
|
+
else
|
76
|
+
combination_timestamp
|
77
|
+
end.to_s
|
78
|
+
end
|
79
|
+
filename
|
80
|
+
end
|
81
|
+
|
57
82
|
end
|
58
83
|
end
|
data/lib/rack/less/options.rb
CHANGED
data/lib/rack/less/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-less
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 1.3.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Kelly Redding
|
@@ -9,69 +14,92 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-03-30 00:00:00 -05:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rack
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 4
|
23
30
|
version: "0.4"
|
24
|
-
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
25
33
|
- !ruby/object:Gem::Dependency
|
26
34
|
name: less
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
37
|
requirements:
|
31
38
|
- - ">="
|
32
39
|
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 1
|
42
|
+
- 2
|
43
|
+
- 21
|
33
44
|
version: 1.2.21
|
34
|
-
|
45
|
+
type: :runtime
|
46
|
+
version_requirements: *id002
|
35
47
|
- !ruby/object:Gem::Dependency
|
36
48
|
name: shoulda
|
37
|
-
|
38
|
-
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
prerelease: false
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
51
|
requirements:
|
41
52
|
- - ">="
|
42
53
|
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 2
|
56
|
+
- 10
|
57
|
+
- 2
|
43
58
|
version: 2.10.2
|
44
|
-
|
59
|
+
type: :development
|
60
|
+
version_requirements: *id003
|
45
61
|
- !ruby/object:Gem::Dependency
|
46
62
|
name: sinatra
|
47
|
-
|
48
|
-
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
prerelease: false
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
50
65
|
requirements:
|
51
66
|
- - ">="
|
52
67
|
- !ruby/object:Gem::Version
|
68
|
+
segments:
|
69
|
+
- 0
|
70
|
+
- 9
|
71
|
+
- 4
|
53
72
|
version: 0.9.4
|
54
|
-
|
73
|
+
type: :development
|
74
|
+
version_requirements: *id004
|
55
75
|
- !ruby/object:Gem::Dependency
|
56
76
|
name: rack-test
|
57
|
-
|
58
|
-
|
59
|
-
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
prerelease: false
|
78
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
60
79
|
requirements:
|
61
80
|
- - ">="
|
62
81
|
- !ruby/object:Gem::Version
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
- 5
|
85
|
+
- 3
|
63
86
|
version: 0.5.3
|
64
|
-
|
87
|
+
type: :development
|
88
|
+
version_requirements: *id005
|
65
89
|
- !ruby/object:Gem::Dependency
|
66
90
|
name: webrat
|
67
|
-
|
68
|
-
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
prerelease: false
|
92
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
70
93
|
requirements:
|
71
94
|
- - ">="
|
72
95
|
- !ruby/object:Gem::Version
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
- 6
|
99
|
+
- 0
|
73
100
|
version: 0.6.0
|
74
|
-
|
101
|
+
type: :development
|
102
|
+
version_requirements: *id006
|
75
103
|
description:
|
76
104
|
email: kelly@kelredd.com
|
77
105
|
executables: []
|
@@ -105,18 +133,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
133
|
requirements:
|
106
134
|
- - ">="
|
107
135
|
- !ruby/object:Gem::Version
|
136
|
+
segments:
|
137
|
+
- 0
|
108
138
|
version: "0"
|
109
|
-
version:
|
110
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
140
|
requirements:
|
112
141
|
- - ">="
|
113
142
|
- !ruby/object:Gem::Version
|
143
|
+
segments:
|
144
|
+
- 0
|
114
145
|
version: "0"
|
115
|
-
version:
|
116
146
|
requirements: []
|
117
147
|
|
118
148
|
rubyforge_project:
|
119
|
-
rubygems_version: 1.3.
|
149
|
+
rubygems_version: 1.3.6
|
120
150
|
signing_key:
|
121
151
|
specification_version: 3
|
122
152
|
summary: A better way to use LESS CSS in Ruby web apps.
|