compass-core-sass37 1.1.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.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/VERSION +1 -0
- data/data/caniuse.json +1 -0
- data/data/caniuse_extras/css-placeholder.json +171 -0
- data/lib/compass/browser_support.rb +64 -0
- data/lib/compass/configuration/adapters.rb +109 -0
- data/lib/compass/configuration/data.rb +199 -0
- data/lib/compass/configuration/defaults.rb +207 -0
- data/lib/compass/configuration/inheritance.rb +307 -0
- data/lib/compass/configuration/paths.rb +19 -0
- data/lib/compass/configuration/watch.rb +38 -0
- data/lib/compass/configuration.rb +175 -0
- data/lib/compass/core/caniuse.rb +314 -0
- data/lib/compass/core/generated_version.rb +6 -0
- data/lib/compass/core/sass_extensions/functions/colors.rb +67 -0
- data/lib/compass/core/sass_extensions/functions/configuration.rb +173 -0
- data/lib/compass/core/sass_extensions/functions/constants.rb +56 -0
- data/lib/compass/core/sass_extensions/functions/cross_browser_support.rb +270 -0
- data/lib/compass/core/sass_extensions/functions/display.rb +32 -0
- data/lib/compass/core/sass_extensions/functions/enumerate.rb +7 -0
- data/lib/compass/core/sass_extensions/functions/env.rb +72 -0
- data/lib/compass/core/sass_extensions/functions/files.rb +33 -0
- data/lib/compass/core/sass_extensions/functions/font_files.rb +65 -0
- data/lib/compass/core/sass_extensions/functions/gradient_support.rb +859 -0
- data/lib/compass/core/sass_extensions/functions/image_size.rb +117 -0
- data/lib/compass/core/sass_extensions/functions/inline_image.rb +63 -0
- data/lib/compass/core/sass_extensions/functions/lists.rb +102 -0
- data/lib/compass/core/sass_extensions/functions/math.rb +105 -0
- data/lib/compass/core/sass_extensions/functions/selectors.rb +79 -0
- data/lib/compass/core/sass_extensions/functions/urls.rb +315 -0
- data/lib/compass/core/sass_extensions/functions.rb +41 -0
- data/lib/compass/core/sass_extensions/monkey_patches/browser_support.rb +119 -0
- data/lib/compass/core/sass_extensions/monkey_patches/traversal.rb +23 -0
- data/lib/compass/core/sass_extensions/monkey_patches.rb +3 -0
- data/lib/compass/core/sass_extensions.rb +10 -0
- data/lib/compass/core/version.rb +13 -0
- data/lib/compass/core.rb +78 -0
- data/lib/compass/error.rb +5 -0
- data/lib/compass/frameworks.rb +181 -0
- data/lib/compass/util.rb +19 -0
- data/lib/compass-core.rb +1 -0
- data/stylesheets/_compass.scss +3 -0
- data/stylesheets/_lemonade.scss +38 -0
- data/stylesheets/compass/_configuration.scss +54 -0
- data/stylesheets/compass/_css3.scss +21 -0
- data/stylesheets/compass/_layout.scss +3 -0
- data/stylesheets/compass/_reset-legacy.scss +3 -0
- data/stylesheets/compass/_reset.scss +3 -0
- data/stylesheets/compass/_support.scss +447 -0
- data/stylesheets/compass/_typography.scss +4 -0
- data/stylesheets/compass/_utilities.scss +9 -0
- data/stylesheets/compass/css3/_animation.scss +122 -0
- data/stylesheets/compass/css3/_appearance.scss +17 -0
- data/stylesheets/compass/css3/_background-clip.scss +35 -0
- data/stylesheets/compass/css3/_background-origin.scss +37 -0
- data/stylesheets/compass/css3/_background-size.scss +19 -0
- data/stylesheets/compass/css3/_border-radius.scss +107 -0
- data/stylesheets/compass/css3/_box-shadow.scss +88 -0
- data/stylesheets/compass/css3/_box-sizing.scss +21 -0
- data/stylesheets/compass/css3/_box.scss +85 -0
- data/stylesheets/compass/css3/_columns.scss +212 -0
- data/stylesheets/compass/css3/_deprecated-support.scss +272 -0
- data/stylesheets/compass/css3/_filter.scss +50 -0
- data/stylesheets/compass/css3/_flexbox.scss +156 -0
- data/stylesheets/compass/css3/_font-face.scss +48 -0
- data/stylesheets/compass/css3/_hyphenation.scss +71 -0
- data/stylesheets/compass/css3/_images.scss +152 -0
- data/stylesheets/compass/css3/_inline-block.scss +31 -0
- data/stylesheets/compass/css3/_opacity.scss +27 -0
- data/stylesheets/compass/css3/_pie.scss +1 -0
- data/stylesheets/compass/css3/_regions.scss +27 -0
- data/stylesheets/compass/css3/_selection.scss +59 -0
- data/stylesheets/compass/css3/_shared.scss +5 -0
- data/stylesheets/compass/css3/_text-shadow.scss +82 -0
- data/stylesheets/compass/css3/_transform.scss +590 -0
- data/stylesheets/compass/css3/_transition.scss +190 -0
- data/stylesheets/compass/css3/_user-interface.scss +71 -0
- data/stylesheets/compass/layout/_grid-background.scss +178 -0
- data/stylesheets/compass/layout/_sticky-footer.scss +23 -0
- data/stylesheets/compass/layout/_stretching.scss +24 -0
- data/stylesheets/compass/reset/_utilities-legacy.scss +135 -0
- data/stylesheets/compass/reset/_utilities.scss +142 -0
- data/stylesheets/compass/typography/_links.scss +3 -0
- data/stylesheets/compass/typography/_lists.scss +4 -0
- data/stylesheets/compass/typography/_text.scss +4 -0
- data/stylesheets/compass/typography/_units.scss +183 -0
- data/stylesheets/compass/typography/_vertical_rhythm.scss +300 -0
- data/stylesheets/compass/typography/links/_hover-link.scss +5 -0
- data/stylesheets/compass/typography/links/_link-colors.scss +28 -0
- data/stylesheets/compass/typography/links/_unstyled-link.scss +7 -0
- data/stylesheets/compass/typography/lists/_bullets.scss +34 -0
- data/stylesheets/compass/typography/lists/_horizontal-list.scss +63 -0
- data/stylesheets/compass/typography/lists/_inline-block-list.scss +50 -0
- data/stylesheets/compass/typography/lists/_inline-list.scss +47 -0
- data/stylesheets/compass/typography/text/_ellipsis.scss +25 -0
- data/stylesheets/compass/typography/text/_force-wrap.scss +12 -0
- data/stylesheets/compass/typography/text/_nowrap.scss +2 -0
- data/stylesheets/compass/typography/text/_replacement.scss +74 -0
- data/stylesheets/compass/utilities/_color.scss +1 -0
- data/stylesheets/compass/utilities/_general.scss +6 -0
- data/stylesheets/compass/utilities/_links.scss +5 -0
- data/stylesheets/compass/utilities/_lists.scss +6 -0
- data/stylesheets/compass/utilities/_print.scss +17 -0
- data/stylesheets/compass/utilities/_sass.scss +2 -0
- data/stylesheets/compass/utilities/_sprites.scss +2 -0
- data/stylesheets/compass/utilities/_tables.scss +3 -0
- data/stylesheets/compass/utilities/_text.scss +5 -0
- data/stylesheets/compass/utilities/color/_brightness.scss +20 -0
- data/stylesheets/compass/utilities/color/_contrast.scss +52 -0
- data/stylesheets/compass/utilities/general/_clearfix.scss +44 -0
- data/stylesheets/compass/utilities/general/_float.scss +38 -0
- data/stylesheets/compass/utilities/general/_hacks.scss +65 -0
- data/stylesheets/compass/utilities/general/_min.scss +16 -0
- data/stylesheets/compass/utilities/general/_reset.scss +2 -0
- data/stylesheets/compass/utilities/general/_tabs.scss +1 -0
- data/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
- data/stylesheets/compass/utilities/links/_hover-link.scss +3 -0
- data/stylesheets/compass/utilities/links/_link-colors.scss +3 -0
- data/stylesheets/compass/utilities/links/_unstyled-link.scss +3 -0
- data/stylesheets/compass/utilities/lists/_bullets.scss +3 -0
- data/stylesheets/compass/utilities/lists/_horizontal-list.scss +3 -0
- data/stylesheets/compass/utilities/lists/_inline-block-list.scss +3 -0
- data/stylesheets/compass/utilities/lists/_inline-list.scss +3 -0
- data/stylesheets/compass/utilities/sass/_lists.scss +16 -0
- data/stylesheets/compass/utilities/sass/_maps.scss +19 -0
- data/stylesheets/compass/utilities/sprites/_base.scss +92 -0
- data/stylesheets/compass/utilities/sprites/_sprite-img.scss +81 -0
- data/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +22 -0
- data/stylesheets/compass/utilities/tables/_borders.scss +38 -0
- data/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
- data/stylesheets/compass/utilities/text/_ellipsis.scss +3 -0
- data/stylesheets/compass/utilities/text/_nowrap.scss +3 -0
- data/stylesheets/compass/utilities/text/_replacement.scss +3 -0
- data/templates/ellipsis/ellipsis.sass +9 -0
- data/templates/ellipsis/manifest.rb +27 -0
- data/templates/ellipsis/xml/ellipsis.xml +14 -0
- data/templates/extension/manifest.rb +26 -0
- data/templates/extension/stylesheets/main.sass +1 -0
- data/templates/extension/templates/project/manifest.rb +2 -0
- data/templates/extension/templates/project/screen.sass +2 -0
- data/templates/project/USAGE.markdown +32 -0
- data/templates/project/ie.sass +6 -0
- data/templates/project/manifest.rb +4 -0
- data/templates/project/print.sass +6 -0
- data/templates/project/screen.sass +7 -0
- metadata +257 -0
@@ -0,0 +1,315 @@
|
|
1
|
+
module Compass::Core::SassExtensions::Functions::Urls
|
2
|
+
|
3
|
+
|
4
|
+
def self.has?(base, instance_method)
|
5
|
+
# Sass::Util.has? was removed in Sass 3.7
|
6
|
+
# Use respond_to? directly instead
|
7
|
+
base.method_defined?(instance_method)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.included(base)
|
11
|
+
base.send(:include, StylesheetUrl) unless has?(base, :stylesheet_url)
|
12
|
+
base.send(:include, FontUrl) unless has?(base, :font_url)
|
13
|
+
base.send(:include, ImageUrl) unless has?(base, :image_url)
|
14
|
+
base.send(:include, GeneratedImageUrl) unless has?(base, :generated_image_url)
|
15
|
+
end
|
16
|
+
|
17
|
+
module StylesheetUrl
|
18
|
+
def self.included(base)
|
19
|
+
if base.respond_to?(:declare)
|
20
|
+
base.declare :stylesheet_url, [:path]
|
21
|
+
base.declare :stylesheet_url, [:path, :only_path]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
def stylesheet_url(path, only_path = bool(false))
|
25
|
+
# Compute the path to the stylesheet, either root relative or stylesheet relative
|
26
|
+
# or nil if the http_images_path is not set in the configuration.
|
27
|
+
http_stylesheets_path = if relative?
|
28
|
+
compute_relative_path(Compass.configuration.css_path)
|
29
|
+
elsif Compass.configuration.http_stylesheets_path
|
30
|
+
Compass.configuration.http_stylesheets_path
|
31
|
+
else
|
32
|
+
Compass.configuration.http_root_relative(Compass.configuration.css_dir)
|
33
|
+
end
|
34
|
+
|
35
|
+
path = "#{http_stylesheets_path}/#{path.value}"
|
36
|
+
if only_path.to_bool
|
37
|
+
unquoted_string(clean_path(path))
|
38
|
+
else
|
39
|
+
clean_url(path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module FontUrl
|
45
|
+
def self.included(base)
|
46
|
+
if base.respond_to?(:declare)
|
47
|
+
base.declare :font_url, [:path]
|
48
|
+
base.declare :font_url, [:path, :only_path]
|
49
|
+
base.declare :font_url, [:path, :only_path, :cache_buster]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
def font_url(path, only_path = bool(false), cache_buster = bool(true))
|
53
|
+
path = path.value # get to the string value of the literal.
|
54
|
+
|
55
|
+
# Short curcuit if they have provided an absolute url.
|
56
|
+
if absolute_path?(path)
|
57
|
+
return unquoted_string("url(#{path})")
|
58
|
+
end
|
59
|
+
|
60
|
+
# Compute the path to the font file, either root relative or stylesheet relative
|
61
|
+
# or nil if the http_fonts_path cannot be determined from the configuration.
|
62
|
+
http_fonts_path = if relative?
|
63
|
+
compute_relative_path(Compass.configuration.fonts_path)
|
64
|
+
else
|
65
|
+
Compass.configuration.http_fonts_path
|
66
|
+
end
|
67
|
+
|
68
|
+
# Compute the real path to the font on the file system if the fonts_dir is set.
|
69
|
+
real_path = if Compass.configuration.fonts_dir
|
70
|
+
File.join(Compass.configuration.fonts_path, path.gsub(/[?#].*$/,""))
|
71
|
+
end
|
72
|
+
|
73
|
+
# prepend the path to the font if there's one
|
74
|
+
if http_fonts_path
|
75
|
+
http_fonts_path = "#{http_fonts_path}/" unless http_fonts_path[-1..-1] == "/"
|
76
|
+
path = "#{http_fonts_path}#{path}"
|
77
|
+
end
|
78
|
+
|
79
|
+
# Compute the asset host unless in relative mode.
|
80
|
+
asset_host = if !relative? && Compass.configuration.asset_host
|
81
|
+
Compass.configuration.asset_host.call(path)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Compute and append the cache buster if there is one.
|
85
|
+
if cache_buster.to_bool
|
86
|
+
path, anchor = path.split("#", 2)
|
87
|
+
if cache_buster.is_a?(Sass::Script::Value::String)
|
88
|
+
path += "#{path["?"] ? "&" : "?"}#{cache_buster.value}"
|
89
|
+
else
|
90
|
+
path = cache_busted_path(path, real_path)
|
91
|
+
end
|
92
|
+
path = "#{path}#{"#" if anchor}#{anchor}"
|
93
|
+
end
|
94
|
+
|
95
|
+
# prepend the asset host if there is one.
|
96
|
+
path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
|
97
|
+
|
98
|
+
if only_path.to_bool
|
99
|
+
unquoted_string(clean_path(path))
|
100
|
+
else
|
101
|
+
clean_url(path)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
module ImageUrl
|
107
|
+
def self.included(base)
|
108
|
+
if base.respond_to?(:declare)
|
109
|
+
base.declare :image_url, [:path]
|
110
|
+
base.declare :image_url, [:path, :only_path]
|
111
|
+
base.declare :image_url, [:path, :only_path, :cache_buster]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
def image_url(path, only_path = bool(false), cache_buster = bool(true))
|
115
|
+
path = path.value # get to the string value of the literal.
|
116
|
+
|
117
|
+
if path =~ %r{^#{Regexp.escape(Compass.configuration.http_images_path)}/(.*)}
|
118
|
+
# Treat root relative urls (without a protocol) like normal if they start with
|
119
|
+
# the images path.
|
120
|
+
path = $1
|
121
|
+
elsif absolute_path?(path)
|
122
|
+
# Short curcuit if they have provided an absolute url.
|
123
|
+
return unquoted_string("url(#{path})")
|
124
|
+
end
|
125
|
+
|
126
|
+
# Compute the path to the image, either root relative or stylesheet relative
|
127
|
+
# or nil if the http_images_path is not set in the configuration.
|
128
|
+
http_images_path = if relative?
|
129
|
+
compute_relative_path(Compass.configuration.images_path)
|
130
|
+
elsif Compass.configuration.http_images_path
|
131
|
+
Compass.configuration.http_images_path
|
132
|
+
else
|
133
|
+
Compass.configuration.http_root_relative(Compass.configuration.images_dir)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Compute the real path to the image on the file stystem if the images_dir is set.
|
137
|
+
real_path = if Compass.configuration.images_path
|
138
|
+
File.join(Compass.configuration.images_path, path.gsub(/#.*$/,""))
|
139
|
+
else
|
140
|
+
File.join(Compass.configuration.project_path, path.gsub(/#.*$/,""))
|
141
|
+
end
|
142
|
+
|
143
|
+
# prepend the path to the image if there's one
|
144
|
+
if http_images_path
|
145
|
+
http_images_path = "#{http_images_path}/" unless http_images_path[-1..-1] == "/"
|
146
|
+
path = "#{http_images_path}#{path}"
|
147
|
+
end
|
148
|
+
|
149
|
+
# Compute the asset host unless in relative mode.
|
150
|
+
asset_host = if !relative? && Compass.configuration.asset_host
|
151
|
+
Compass.configuration.asset_host.call(path)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Compute and append the cache buster if there is one.
|
155
|
+
if cache_buster.to_bool
|
156
|
+
path, anchor = path.split("#", 2)
|
157
|
+
if cache_buster.is_a?(Sass::Script::Value::String)
|
158
|
+
path += "#{path["?"] ? "&" : "?"}#{cache_buster.value}"
|
159
|
+
else
|
160
|
+
path = cache_busted_path(path, real_path)
|
161
|
+
end
|
162
|
+
path = "#{path}#{"#" if anchor}#{anchor}"
|
163
|
+
end
|
164
|
+
|
165
|
+
# prepend the asset host if there is one.
|
166
|
+
path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
|
167
|
+
|
168
|
+
if only_path.to_bool
|
169
|
+
unquoted_string(clean_path(path))
|
170
|
+
else
|
171
|
+
clean_url(path)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
module GeneratedImageUrl
|
177
|
+
def self.included(base)
|
178
|
+
if base.respond_to?(:declare)
|
179
|
+
base.declare :generated_image_url, [:path]
|
180
|
+
base.declare :generated_image_url, [:path, :cache_buster]
|
181
|
+
end
|
182
|
+
end
|
183
|
+
def generated_image_url(path, cache_buster = bool(false))
|
184
|
+
path = path.value # get to the string value of the literal.
|
185
|
+
|
186
|
+
if path =~ %r{^#{Regexp.escape(Compass.configuration.http_generated_images_path)}/(.*)}
|
187
|
+
# Treat root relative urls (without a protocol) like normal if they start with
|
188
|
+
# the generated_images path.
|
189
|
+
path = $1
|
190
|
+
elsif absolute_path?(path)
|
191
|
+
# Short curcuit if they have provided an absolute url.
|
192
|
+
return unquoted_string("url(#{path})")
|
193
|
+
end
|
194
|
+
|
195
|
+
# Compute the path to the image, either root relative or stylesheet relative
|
196
|
+
# or nil if the http_generated_images_path is not set in the configuration.
|
197
|
+
http_generated_images_path = if relative?
|
198
|
+
compute_relative_path(Compass.configuration.generated_images_path)
|
199
|
+
elsif Compass.configuration.http_generated_images_path
|
200
|
+
Compass.configuration.http_generated_images_path
|
201
|
+
else
|
202
|
+
Compass.configuration.http_root_relative(Compass.configuration.generated_images_dir)
|
203
|
+
end
|
204
|
+
|
205
|
+
# Compute the real path to the image on the file stystem if the generated_images_dir is set.
|
206
|
+
real_path = if Compass.configuration.generated_images_path
|
207
|
+
File.join(Compass.configuration.generated_images_path, path.gsub(/#.*$/,""))
|
208
|
+
else
|
209
|
+
File.join(Compass.configuration.project_path, path.gsub(/#.*$/,""))
|
210
|
+
end
|
211
|
+
|
212
|
+
# prepend the path to the image if there's one
|
213
|
+
if http_generated_images_path
|
214
|
+
http_generated_images_path = "#{http_generated_images_path}/" unless http_generated_images_path[-1..-1] == "/"
|
215
|
+
path = "#{http_generated_images_path}#{path}"
|
216
|
+
end
|
217
|
+
|
218
|
+
# Compute the asset host unless in relative mode.
|
219
|
+
asset_host = if !relative? && Compass.configuration.asset_host
|
220
|
+
Compass.configuration.asset_host.call(path)
|
221
|
+
end
|
222
|
+
|
223
|
+
# Compute and append the cache buster if there is one.
|
224
|
+
if cache_buster.to_bool
|
225
|
+
path, anchor = path.split("#", 2)
|
226
|
+
if cache_buster.is_a?(Sass::Script::Value::String)
|
227
|
+
path += "#{path["?"] ? "&" : "?"}#{cache_buster.value}"
|
228
|
+
else
|
229
|
+
path = cache_busted_path(path, real_path)
|
230
|
+
end
|
231
|
+
path = "#{path}#{"#" if anchor}#{anchor}"
|
232
|
+
end
|
233
|
+
|
234
|
+
# prepend the asset host if there is one.
|
235
|
+
path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
|
236
|
+
|
237
|
+
clean_url(path)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
private
|
242
|
+
|
243
|
+
# Emits a path, taking off any leading "./"
|
244
|
+
def clean_path(url)
|
245
|
+
url = url.to_s
|
246
|
+
url = url[0..1] == "./" ? url[2..-1] : url
|
247
|
+
end
|
248
|
+
|
249
|
+
# Emits a url, taking off any leading "./"
|
250
|
+
def clean_url(url)
|
251
|
+
unquoted_string("url('#{clean_path(url)}')")
|
252
|
+
end
|
253
|
+
|
254
|
+
def relative?
|
255
|
+
Compass.configuration.relative_assets?
|
256
|
+
end
|
257
|
+
|
258
|
+
def absolute_path?(path)
|
259
|
+
path[0..0] == "/" || path[0..3] == "http"
|
260
|
+
end
|
261
|
+
|
262
|
+
def compute_relative_path(path)
|
263
|
+
if (target_css_file = options[:css_filename])
|
264
|
+
target_path = Pathname.new(File.expand_path(path))
|
265
|
+
source_path = Pathname.new(File.dirname(File.expand_path(target_css_file)))
|
266
|
+
target_path.relative_path_from(source_path).to_s
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
def cache_busted_path(path, real_path)
|
271
|
+
cache_buster = compute_cache_buster(path, real_path)
|
272
|
+
if cache_buster.nil?
|
273
|
+
return path
|
274
|
+
elsif cache_buster.is_a?(String)
|
275
|
+
cache_buster = {:query => cache_buster}
|
276
|
+
else
|
277
|
+
path = cache_buster[:path] if cache_buster[:path]
|
278
|
+
end
|
279
|
+
|
280
|
+
if cache_buster[:query]
|
281
|
+
"#{path}#{path["?"] ? "&" : "?"}#{cache_buster[:query]}"
|
282
|
+
else
|
283
|
+
path
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
def compute_cache_buster(path, real_path)
|
288
|
+
file = nil
|
289
|
+
if Compass.configuration.asset_cache_buster
|
290
|
+
args = [path]
|
291
|
+
if Compass.configuration.asset_cache_buster.arity > 1
|
292
|
+
begin
|
293
|
+
file = File.new(real_path) if real_path
|
294
|
+
rescue Errno::ENOENT
|
295
|
+
# pass
|
296
|
+
end
|
297
|
+
args << file
|
298
|
+
end
|
299
|
+
Compass.configuration.asset_cache_buster.call(*args)
|
300
|
+
elsif real_path
|
301
|
+
default_cache_buster(path, real_path)
|
302
|
+
end
|
303
|
+
ensure
|
304
|
+
file.close if file
|
305
|
+
end
|
306
|
+
|
307
|
+
def default_cache_buster(path, real_path)
|
308
|
+
if File.readable?(real_path)
|
309
|
+
File.mtime(real_path).to_i.to_s
|
310
|
+
else
|
311
|
+
$stderr.puts "WARNING: '#{File.basename(path)}' was not found (or cannot be read) in #{File.dirname(real_path)}"
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Compass::Core::SassExtensions::Functions
|
2
|
+
module SassDeclarationHelper
|
3
|
+
def declare(*args)
|
4
|
+
Sass::Script::Functions.declare(*args)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
%w(
|
10
|
+
selectors enumerate urls display
|
11
|
+
inline_image image_size constants gradient_support
|
12
|
+
font_files lists colors math
|
13
|
+
env cross_browser_support configuration
|
14
|
+
files
|
15
|
+
).each do |func|
|
16
|
+
require "compass/core/sass_extensions/functions/#{func}"
|
17
|
+
end
|
18
|
+
|
19
|
+
module Sass::Script::Functions
|
20
|
+
include Compass::Core::SassExtensions::Functions::Configuration
|
21
|
+
include Compass::Core::SassExtensions::Functions::Selectors
|
22
|
+
include Compass::Core::SassExtensions::Functions::Enumerate
|
23
|
+
include Compass::Core::SassExtensions::Functions::Urls
|
24
|
+
include Compass::Core::SassExtensions::Functions::Display
|
25
|
+
include Compass::Core::SassExtensions::Functions::InlineImage
|
26
|
+
include Compass::Core::SassExtensions::Functions::ImageSize
|
27
|
+
include Compass::Core::SassExtensions::Functions::GradientSupport::Functions
|
28
|
+
include Compass::Core::SassExtensions::Functions::FontFiles
|
29
|
+
include Compass::Core::SassExtensions::Functions::Files
|
30
|
+
include Compass::Core::SassExtensions::Functions::Constants
|
31
|
+
include Compass::Core::SassExtensions::Functions::Lists
|
32
|
+
include Compass::Core::SassExtensions::Functions::Colors
|
33
|
+
include Compass::Core::SassExtensions::Functions::Math
|
34
|
+
include Compass::Core::SassExtensions::Functions::CrossBrowserSupport
|
35
|
+
include Compass::Core::SassExtensions::Functions::Env
|
36
|
+
end
|
37
|
+
|
38
|
+
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
39
|
+
class Sass::Script::Functions::EvaluationContext
|
40
|
+
include Sass::Script::Functions
|
41
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
require 'sass/script'
|
2
|
+
|
3
|
+
module Sass::Script
|
4
|
+
module Value
|
5
|
+
class Base
|
6
|
+
NO_CHILDREN = []
|
7
|
+
def children
|
8
|
+
NO_CHILDREN
|
9
|
+
end
|
10
|
+
|
11
|
+
def opts(value)
|
12
|
+
value.options = options
|
13
|
+
value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class List < Base
|
18
|
+
def children
|
19
|
+
value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class ArgList < List
|
24
|
+
def children
|
25
|
+
super + @keywords.values
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Map < Base
|
30
|
+
def children
|
31
|
+
to_a
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
module HasSimpleCrossBrowserFunctionSupport
|
36
|
+
def supports?(aspect)
|
37
|
+
return true if Compass::BrowserSupport.supports?(name, aspect)
|
38
|
+
children.any? {|child| child.respond_to?(:supports?) && child.supports?(aspect) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def has_aspect?(children = nil)
|
42
|
+
children ||= self.children
|
43
|
+
return true if Compass::BrowserSupport.has_aspect?(name)
|
44
|
+
children.any? {|child| child.respond_to?(:has_aspect?) && child.has_aspect? }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class CrossBrowserFunctionCall < Literal
|
49
|
+
|
50
|
+
attr_accessor :name, :args
|
51
|
+
|
52
|
+
include HasSimpleCrossBrowserFunctionSupport
|
53
|
+
include Sass::Script::Value::Helpers
|
54
|
+
|
55
|
+
def initialize(name, args)
|
56
|
+
self.name = name
|
57
|
+
self.args = args
|
58
|
+
end
|
59
|
+
|
60
|
+
def children
|
61
|
+
args
|
62
|
+
end
|
63
|
+
|
64
|
+
def inspect
|
65
|
+
to_s
|
66
|
+
end
|
67
|
+
|
68
|
+
def to_s(options = self.options)
|
69
|
+
"#{name}(#{args.map{|a| a.to_s(options)}.join(", ")})"
|
70
|
+
end
|
71
|
+
|
72
|
+
%w(webkit moz o ms svg css2 owg).each do |prefix|
|
73
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
74
|
+
def to_#{prefix}(options = self.options)
|
75
|
+
prefixed_args = args.map do |arg|
|
76
|
+
arg.respond_to?(:to_#{prefix}) ? arg.to_#{prefix}(options) : arg
|
77
|
+
end
|
78
|
+
prefixed_name = if Compass::BrowserSupport.supports?(name, "#{prefix}")
|
79
|
+
"-#{prefix}-\#{name}"
|
80
|
+
else
|
81
|
+
name
|
82
|
+
end
|
83
|
+
contents = prefixed_args.join(', ')
|
84
|
+
if contents.size > 0
|
85
|
+
opts(identifier("\#{prefixed_name}(\#{contents})"))
|
86
|
+
else
|
87
|
+
opts(null)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
RUBY
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
class Funcall < Node
|
96
|
+
include HasSimpleCrossBrowserFunctionSupport
|
97
|
+
|
98
|
+
alias sass_to_value to_value
|
99
|
+
|
100
|
+
def to_value(args)
|
101
|
+
if has_aspect?(args)
|
102
|
+
CrossBrowserFunctionCall.new(name, args)
|
103
|
+
else
|
104
|
+
sass_to_value(args)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
class List < Literal
|
110
|
+
def supports?(aspect)
|
111
|
+
children.any? {|child| child.respond_to?(:supports?) && child.supports?(aspect) }
|
112
|
+
end
|
113
|
+
|
114
|
+
def has_aspect?
|
115
|
+
children.any? {|child| child.respond_to?(:has_aspect?) && child.has_aspect? }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Sass
|
2
|
+
module Tree
|
3
|
+
class Node
|
4
|
+
unless method_defined?(:visit_depth_first)
|
5
|
+
def visit_depth_first(visitor)
|
6
|
+
visitor.visit(self)
|
7
|
+
visitor.down(self) if children.any? and visitor.respond_to?(:down)
|
8
|
+
if is_a?(ImportNode) && visitor.import?(self)
|
9
|
+
root = Sass::Engine.for_file(import, @options).to_tree
|
10
|
+
imported_children = root.children
|
11
|
+
end
|
12
|
+
|
13
|
+
(imported_children || children).each do |child|
|
14
|
+
break if visitor.respond_to?(:stop?) && visitor.stop?
|
15
|
+
child.visit_depth_first(visitor)
|
16
|
+
end
|
17
|
+
visitor.up(self) if children.any?
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'sass'
|
2
|
+
unless Sass::Script::Functions.methods.grep(/\Adeclare\Z/).any?
|
3
|
+
raise LoadError, "It looks like you've got an incompatible version of Sass. This often happens when you have an old haml gem installed. Please upgrade Haml to v3.1 or above."
|
4
|
+
end
|
5
|
+
|
6
|
+
module Compass::Core::SassExtensions
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'compass/core/sass_extensions/functions'
|
10
|
+
require 'compass/core/sass_extensions/monkey_patches'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'compass/core/generated_version'
|
2
|
+
|
3
|
+
module Compass
|
4
|
+
module Core
|
5
|
+
unless defined?(::Compass::Core::VERSION)
|
6
|
+
def self.scope(file)
|
7
|
+
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", file))
|
8
|
+
end
|
9
|
+
|
10
|
+
VERSION = File.read(scope("VERSION")).strip
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/compass/core.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require "compass/core/version"
|
2
|
+
|
3
|
+
module Compass
|
4
|
+
module Core
|
5
|
+
class << self
|
6
|
+
attr_accessor :module_deprecation_warning_issued
|
7
|
+
end
|
8
|
+
def base_directory(*subdirs)
|
9
|
+
File.expand_path(File.join(File.dirname(__FILE__), '..', "..", *subdirs))
|
10
|
+
end
|
11
|
+
def lib_directory(*subdirs)
|
12
|
+
File.expand_path(File.join(File.dirname(__FILE__), "..", *subdirs))
|
13
|
+
end
|
14
|
+
|
15
|
+
module_function :base_directory, :lib_directory
|
16
|
+
end
|
17
|
+
|
18
|
+
module HasDeprecatedConstantsFromCore
|
19
|
+
def self.extended(base)
|
20
|
+
new_base = base.name.sub(/^Compass/,"Compass::Core")
|
21
|
+
base.class_eval <<-RUBY
|
22
|
+
def self.const_missing(const_name)
|
23
|
+
puts "cannot find \#{const_name}"
|
24
|
+
if #{new_base}.const_defined?(const_name)
|
25
|
+
unless Compass::Core.module_deprecation_warning_issued
|
26
|
+
Compass::Core.module_deprecation_warning_issued = true
|
27
|
+
Compass::Util.compass_warn(
|
28
|
+
"DEPRECATED: #{base.name}::\#{const_name} has been moved to " +
|
29
|
+
"#{new_base}::\#{const_name}.\\n" +
|
30
|
+
"Please update \#{caller[0]}")
|
31
|
+
end
|
32
|
+
#{new_base}.const_get(const_name)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
RUBY
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
extend HasDeprecatedConstantsFromCore
|
40
|
+
|
41
|
+
module SassExtensions
|
42
|
+
extend HasDeprecatedConstantsFromCore
|
43
|
+
|
44
|
+
module Functions
|
45
|
+
extend HasDeprecatedConstantsFromCore
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def shared_extension_paths
|
50
|
+
@shared_extension_paths ||= begin
|
51
|
+
if ENV["HOME"] && File.directory?(ENV["HOME"])
|
52
|
+
[File.join(ENV["HOME"], ".compass", "extensions")]
|
53
|
+
else
|
54
|
+
[]
|
55
|
+
end
|
56
|
+
rescue ArgumentError # If HOME is relative
|
57
|
+
[]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
module_function :shared_extension_paths
|
61
|
+
end
|
62
|
+
|
63
|
+
require "sass"
|
64
|
+
require "sass/plugin"
|
65
|
+
require 'compass/util'
|
66
|
+
require "compass/frameworks"
|
67
|
+
require "compass/core/caniuse"
|
68
|
+
require 'compass/core/sass_extensions'
|
69
|
+
require 'compass/error'
|
70
|
+
require 'compass/browser_support'
|
71
|
+
require 'compass/configuration'
|
72
|
+
|
73
|
+
Compass::Frameworks.register(
|
74
|
+
"compass",
|
75
|
+
:stylesheets_directory => Compass::Core.base_directory("stylesheets"),
|
76
|
+
:templates_directory => Compass::Core.base_directory("templates"),
|
77
|
+
:version => Compass::Core::VERSION
|
78
|
+
)
|