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.
Files changed (147) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/VERSION +1 -0
  4. data/data/caniuse.json +1 -0
  5. data/data/caniuse_extras/css-placeholder.json +171 -0
  6. data/lib/compass/browser_support.rb +64 -0
  7. data/lib/compass/configuration/adapters.rb +109 -0
  8. data/lib/compass/configuration/data.rb +199 -0
  9. data/lib/compass/configuration/defaults.rb +207 -0
  10. data/lib/compass/configuration/inheritance.rb +307 -0
  11. data/lib/compass/configuration/paths.rb +19 -0
  12. data/lib/compass/configuration/watch.rb +38 -0
  13. data/lib/compass/configuration.rb +175 -0
  14. data/lib/compass/core/caniuse.rb +314 -0
  15. data/lib/compass/core/generated_version.rb +6 -0
  16. data/lib/compass/core/sass_extensions/functions/colors.rb +67 -0
  17. data/lib/compass/core/sass_extensions/functions/configuration.rb +173 -0
  18. data/lib/compass/core/sass_extensions/functions/constants.rb +56 -0
  19. data/lib/compass/core/sass_extensions/functions/cross_browser_support.rb +270 -0
  20. data/lib/compass/core/sass_extensions/functions/display.rb +32 -0
  21. data/lib/compass/core/sass_extensions/functions/enumerate.rb +7 -0
  22. data/lib/compass/core/sass_extensions/functions/env.rb +72 -0
  23. data/lib/compass/core/sass_extensions/functions/files.rb +33 -0
  24. data/lib/compass/core/sass_extensions/functions/font_files.rb +65 -0
  25. data/lib/compass/core/sass_extensions/functions/gradient_support.rb +859 -0
  26. data/lib/compass/core/sass_extensions/functions/image_size.rb +117 -0
  27. data/lib/compass/core/sass_extensions/functions/inline_image.rb +63 -0
  28. data/lib/compass/core/sass_extensions/functions/lists.rb +102 -0
  29. data/lib/compass/core/sass_extensions/functions/math.rb +105 -0
  30. data/lib/compass/core/sass_extensions/functions/selectors.rb +79 -0
  31. data/lib/compass/core/sass_extensions/functions/urls.rb +315 -0
  32. data/lib/compass/core/sass_extensions/functions.rb +41 -0
  33. data/lib/compass/core/sass_extensions/monkey_patches/browser_support.rb +119 -0
  34. data/lib/compass/core/sass_extensions/monkey_patches/traversal.rb +23 -0
  35. data/lib/compass/core/sass_extensions/monkey_patches.rb +3 -0
  36. data/lib/compass/core/sass_extensions.rb +10 -0
  37. data/lib/compass/core/version.rb +13 -0
  38. data/lib/compass/core.rb +78 -0
  39. data/lib/compass/error.rb +5 -0
  40. data/lib/compass/frameworks.rb +181 -0
  41. data/lib/compass/util.rb +19 -0
  42. data/lib/compass-core.rb +1 -0
  43. data/stylesheets/_compass.scss +3 -0
  44. data/stylesheets/_lemonade.scss +38 -0
  45. data/stylesheets/compass/_configuration.scss +54 -0
  46. data/stylesheets/compass/_css3.scss +21 -0
  47. data/stylesheets/compass/_layout.scss +3 -0
  48. data/stylesheets/compass/_reset-legacy.scss +3 -0
  49. data/stylesheets/compass/_reset.scss +3 -0
  50. data/stylesheets/compass/_support.scss +447 -0
  51. data/stylesheets/compass/_typography.scss +4 -0
  52. data/stylesheets/compass/_utilities.scss +9 -0
  53. data/stylesheets/compass/css3/_animation.scss +122 -0
  54. data/stylesheets/compass/css3/_appearance.scss +17 -0
  55. data/stylesheets/compass/css3/_background-clip.scss +35 -0
  56. data/stylesheets/compass/css3/_background-origin.scss +37 -0
  57. data/stylesheets/compass/css3/_background-size.scss +19 -0
  58. data/stylesheets/compass/css3/_border-radius.scss +107 -0
  59. data/stylesheets/compass/css3/_box-shadow.scss +88 -0
  60. data/stylesheets/compass/css3/_box-sizing.scss +21 -0
  61. data/stylesheets/compass/css3/_box.scss +85 -0
  62. data/stylesheets/compass/css3/_columns.scss +212 -0
  63. data/stylesheets/compass/css3/_deprecated-support.scss +272 -0
  64. data/stylesheets/compass/css3/_filter.scss +50 -0
  65. data/stylesheets/compass/css3/_flexbox.scss +156 -0
  66. data/stylesheets/compass/css3/_font-face.scss +48 -0
  67. data/stylesheets/compass/css3/_hyphenation.scss +71 -0
  68. data/stylesheets/compass/css3/_images.scss +152 -0
  69. data/stylesheets/compass/css3/_inline-block.scss +31 -0
  70. data/stylesheets/compass/css3/_opacity.scss +27 -0
  71. data/stylesheets/compass/css3/_pie.scss +1 -0
  72. data/stylesheets/compass/css3/_regions.scss +27 -0
  73. data/stylesheets/compass/css3/_selection.scss +59 -0
  74. data/stylesheets/compass/css3/_shared.scss +5 -0
  75. data/stylesheets/compass/css3/_text-shadow.scss +82 -0
  76. data/stylesheets/compass/css3/_transform.scss +590 -0
  77. data/stylesheets/compass/css3/_transition.scss +190 -0
  78. data/stylesheets/compass/css3/_user-interface.scss +71 -0
  79. data/stylesheets/compass/layout/_grid-background.scss +178 -0
  80. data/stylesheets/compass/layout/_sticky-footer.scss +23 -0
  81. data/stylesheets/compass/layout/_stretching.scss +24 -0
  82. data/stylesheets/compass/reset/_utilities-legacy.scss +135 -0
  83. data/stylesheets/compass/reset/_utilities.scss +142 -0
  84. data/stylesheets/compass/typography/_links.scss +3 -0
  85. data/stylesheets/compass/typography/_lists.scss +4 -0
  86. data/stylesheets/compass/typography/_text.scss +4 -0
  87. data/stylesheets/compass/typography/_units.scss +183 -0
  88. data/stylesheets/compass/typography/_vertical_rhythm.scss +300 -0
  89. data/stylesheets/compass/typography/links/_hover-link.scss +5 -0
  90. data/stylesheets/compass/typography/links/_link-colors.scss +28 -0
  91. data/stylesheets/compass/typography/links/_unstyled-link.scss +7 -0
  92. data/stylesheets/compass/typography/lists/_bullets.scss +34 -0
  93. data/stylesheets/compass/typography/lists/_horizontal-list.scss +63 -0
  94. data/stylesheets/compass/typography/lists/_inline-block-list.scss +50 -0
  95. data/stylesheets/compass/typography/lists/_inline-list.scss +47 -0
  96. data/stylesheets/compass/typography/text/_ellipsis.scss +25 -0
  97. data/stylesheets/compass/typography/text/_force-wrap.scss +12 -0
  98. data/stylesheets/compass/typography/text/_nowrap.scss +2 -0
  99. data/stylesheets/compass/typography/text/_replacement.scss +74 -0
  100. data/stylesheets/compass/utilities/_color.scss +1 -0
  101. data/stylesheets/compass/utilities/_general.scss +6 -0
  102. data/stylesheets/compass/utilities/_links.scss +5 -0
  103. data/stylesheets/compass/utilities/_lists.scss +6 -0
  104. data/stylesheets/compass/utilities/_print.scss +17 -0
  105. data/stylesheets/compass/utilities/_sass.scss +2 -0
  106. data/stylesheets/compass/utilities/_sprites.scss +2 -0
  107. data/stylesheets/compass/utilities/_tables.scss +3 -0
  108. data/stylesheets/compass/utilities/_text.scss +5 -0
  109. data/stylesheets/compass/utilities/color/_brightness.scss +20 -0
  110. data/stylesheets/compass/utilities/color/_contrast.scss +52 -0
  111. data/stylesheets/compass/utilities/general/_clearfix.scss +44 -0
  112. data/stylesheets/compass/utilities/general/_float.scss +38 -0
  113. data/stylesheets/compass/utilities/general/_hacks.scss +65 -0
  114. data/stylesheets/compass/utilities/general/_min.scss +16 -0
  115. data/stylesheets/compass/utilities/general/_reset.scss +2 -0
  116. data/stylesheets/compass/utilities/general/_tabs.scss +1 -0
  117. data/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
  118. data/stylesheets/compass/utilities/links/_hover-link.scss +3 -0
  119. data/stylesheets/compass/utilities/links/_link-colors.scss +3 -0
  120. data/stylesheets/compass/utilities/links/_unstyled-link.scss +3 -0
  121. data/stylesheets/compass/utilities/lists/_bullets.scss +3 -0
  122. data/stylesheets/compass/utilities/lists/_horizontal-list.scss +3 -0
  123. data/stylesheets/compass/utilities/lists/_inline-block-list.scss +3 -0
  124. data/stylesheets/compass/utilities/lists/_inline-list.scss +3 -0
  125. data/stylesheets/compass/utilities/sass/_lists.scss +16 -0
  126. data/stylesheets/compass/utilities/sass/_maps.scss +19 -0
  127. data/stylesheets/compass/utilities/sprites/_base.scss +92 -0
  128. data/stylesheets/compass/utilities/sprites/_sprite-img.scss +81 -0
  129. data/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +22 -0
  130. data/stylesheets/compass/utilities/tables/_borders.scss +38 -0
  131. data/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
  132. data/stylesheets/compass/utilities/text/_ellipsis.scss +3 -0
  133. data/stylesheets/compass/utilities/text/_nowrap.scss +3 -0
  134. data/stylesheets/compass/utilities/text/_replacement.scss +3 -0
  135. data/templates/ellipsis/ellipsis.sass +9 -0
  136. data/templates/ellipsis/manifest.rb +27 -0
  137. data/templates/ellipsis/xml/ellipsis.xml +14 -0
  138. data/templates/extension/manifest.rb +26 -0
  139. data/templates/extension/stylesheets/main.sass +1 -0
  140. data/templates/extension/templates/project/manifest.rb +2 -0
  141. data/templates/extension/templates/project/screen.sass +2 -0
  142. data/templates/project/USAGE.markdown +32 -0
  143. data/templates/project/ie.sass +6 -0
  144. data/templates/project/manifest.rb +4 -0
  145. data/templates/project/print.sass +6 -0
  146. data/templates/project/screen.sass +7 -0
  147. metadata +257 -0
@@ -0,0 +1,171 @@
1
+ {
2
+ "title":"::placeholder CSS pseudo-element",
3
+ "description":"The ::placeholder pseudo-element represents any form element displaying placeholder text.",
4
+ "spec":"https://developer.mozilla.org/en-US/docs/Web/CSS/::-moz-placeholder",
5
+ "status":"unoff",
6
+ "links":[
7
+ {
8
+ "url":"http://css-tricks.com/snippets/css/style-placeholder-text/",
9
+ "title":"CSS-Tricks article with all prefixes"
10
+ },
11
+ {
12
+ "url":"http://wiki.csswg.org/ideas/placeholder-styling",
13
+ "title":"CSSWG discussion"
14
+ },
15
+ {
16
+ "url":"http://msdn.microsoft.com/en-us/library/ie/hh772745(v=vs.85).aspx",
17
+ "title":"MSDN article"
18
+ }
19
+ ],
20
+ "bugs":[
21
+
22
+ ],
23
+ "categories":[
24
+ "CSS"
25
+ ],
26
+ "stats":{
27
+ "ie":{
28
+ "5.5":"n",
29
+ "6":"n",
30
+ "7":"n",
31
+ "8":"n",
32
+ "9":"n",
33
+ "10":"y x",
34
+ "11":"y x"
35
+ },
36
+ "firefox":{
37
+ "2":"n",
38
+ "3":"n",
39
+ "3.5":"n",
40
+ "3.6":"n",
41
+ "4":"y x",
42
+ "5":"y x",
43
+ "6":"y x",
44
+ "7":"y x",
45
+ "8":"y x",
46
+ "9":"y x",
47
+ "10":"y x",
48
+ "11":"y x",
49
+ "12":"y x",
50
+ "13":"y x",
51
+ "14":"y x",
52
+ "15":"y x",
53
+ "16":"y x",
54
+ "17":"y x",
55
+ "18":"y x",
56
+ "19":"y x",
57
+ "20":"y x",
58
+ "21":"y x",
59
+ "22":"y x",
60
+ "23":"y x",
61
+ "24":"y x",
62
+ "25":"y x",
63
+ "26":"y x"
64
+ },
65
+ "chrome":{
66
+ "4":"y x",
67
+ "5":"y x",
68
+ "6":"y x",
69
+ "7":"y x",
70
+ "8":"y x",
71
+ "9":"y x",
72
+ "10":"y x",
73
+ "11":"y x",
74
+ "12":"y x",
75
+ "13":"y x",
76
+ "14":"y x",
77
+ "15":"y x",
78
+ "16":"y x",
79
+ "17":"y x",
80
+ "18":"y x",
81
+ "19":"y x",
82
+ "20":"y x",
83
+ "21":"y x",
84
+ "22":"y x",
85
+ "23":"y x",
86
+ "24":"y x",
87
+ "25":"y x",
88
+ "26":"y x",
89
+ "27":"y x",
90
+ "28":"y x",
91
+ "29":"y x",
92
+ "30":"y x",
93
+ "31":"y x",
94
+ "32":"y x"
95
+ },
96
+ "safari":{
97
+ "3.1":"n",
98
+ "3.2":"n",
99
+ "4":"n",
100
+ "5":"y x",
101
+ "5.1":"y x",
102
+ "6":"y x",
103
+ "7":"y x"
104
+ },
105
+ "opera":{
106
+ "9":"n",
107
+ "9.5-9.6":"n",
108
+ "10.0-10.1":"n",
109
+ "10.5":"n",
110
+ "10.6":"n",
111
+ "11":"n",
112
+ "11.1":"n",
113
+ "11.5":"n",
114
+ "11.6":"n",
115
+ "12":"n",
116
+ "12.1":"n",
117
+ "15":"y x",
118
+ "16":"a",
119
+ "17":"a"
120
+ },
121
+ "ios_saf":{
122
+ "3.2":"n",
123
+ "4.0-4.1":"n",
124
+ "4.2-4.3":"y x",
125
+ "5.0-5.1":"y x",
126
+ "6.0-6.1":"y x",
127
+ "7.0":"y x"
128
+ },
129
+ "op_mini":{
130
+ "5.0-7.0":"n"
131
+ },
132
+ "android":{
133
+ "2.1":"u",
134
+ "2.2":"u",
135
+ "2.3":"u",
136
+ "3":"u",
137
+ "4":"u",
138
+ "4.1":"u",
139
+ "4.2":"u"
140
+ },
141
+ "bb":{
142
+ "7":"u",
143
+ "10":"u"
144
+ },
145
+ "op_mob":{
146
+ "10":"n",
147
+ "11":"n",
148
+ "11.1":"n",
149
+ "11.5":"n",
150
+ "12":"n",
151
+ "12.1":"n",
152
+ "14":"y x"
153
+ },
154
+ "and_chr":{
155
+ "0":"y x"
156
+ },
157
+ "and_ff":{
158
+ "0":"n"
159
+ },
160
+ "ie_mob":{
161
+ "10":"y x"
162
+ }
163
+ },
164
+ "notes":"",
165
+ "usage_perc_y":70.21,
166
+ "usage_perc_a":0.18,
167
+ "ucprefix":false,
168
+ "parent":"",
169
+ "keywords":"::placeholder,placeholder",
170
+ "shown":false
171
+ }
@@ -0,0 +1,64 @@
1
+ module Compass
2
+ module BrowserSupport
3
+ extend self
4
+
5
+ ASPECTS = %w(webkit moz o ms svg css2)
6
+
7
+ SIMPLE_FUNCTIONS = {
8
+ "image" => %w(webkit),
9
+ "cross-fade" => %w(webkit),
10
+ "repeating-linear-gradient" => %w(webkit moz), # Hacky implementation
11
+ "repeating-radial-gradient" => %w(webkit moz) # Hacky implementation
12
+ }
13
+
14
+ # Adds support for one or more aspects for the given simple function
15
+ # Example:
16
+ #
17
+ # Compass::BrowserSupport.add_support("image", "moz", "webkit")
18
+ # # => Adds support for moz and webkit to the image() function.
19
+ #
20
+ # This function can be called one or more times in a compass configuration
21
+ # file in order to add support for new, simple browser functions without
22
+ # waiting for a new compass release.
23
+ def add_support(function, *aspects)
24
+ aspects.each do |aspect|
25
+ unless ASPECTS.include?(aspect)
26
+ Compass::Util.compass_warn "Unknown support aspect: #{aspect}"
27
+ next
28
+ end
29
+ unless supports?(function, aspect)
30
+ SIMPLE_FUNCTIONS[function.to_s] ||= []
31
+ SIMPLE_FUNCTIONS[function.to_s] << aspect.to_s
32
+ end
33
+ end
34
+ end
35
+
36
+ # Removes support for one or more aspects for the given simple function
37
+ # Example:
38
+ #
39
+ # Compass::BrowserSupport.remove_support("image", "o", "ms")
40
+ # # => Adds support for moz and webkit to the image() function.
41
+ #
42
+ # This function can be called one or more times in a compass configuration
43
+ # file in order to remove support for simple functions that no longer need to
44
+ # a prefix without waiting for a new compass release.
45
+ def remove_support(function, *aspects)
46
+ aspects.each do |aspect|
47
+ unless ASPECTS.include?(aspect)
48
+ Compass::Util.compass_warn "Unknown support aspect: #{aspect}"
49
+ next
50
+ end
51
+ SIMPLE_FUNCTIONS[function.to_s].reject!{|a| a == aspect.to_s}
52
+ end
53
+ end
54
+
55
+ def supports?(function, aspect)
56
+ SIMPLE_FUNCTIONS.has_key?(function.to_s) && SIMPLE_FUNCTIONS[function.to_s].include?(aspect.to_s)
57
+ end
58
+
59
+ def has_aspect?(function)
60
+ SIMPLE_FUNCTIONS.has_key?(function.to_s) && SIMPLE_FUNCTIONS[function.to_s].size > 0
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,109 @@
1
+ module Compass
2
+ module Configuration
3
+ # The adapters module provides methods that make configuration data from a compass project
4
+ # adapt to various consumers of configuration data
5
+ module Adapters
6
+ def to_compiler_arguments(additional_options = {})
7
+ engine_opts = to_sass_engine_options.merge(additional_options)
8
+ # we have to pass the quiet option in the nested :sass hash to disambiguate it from the compass compiler's own quiet option.
9
+ if engine_opts.has_key?(:quiet)
10
+ engine_opts[:sass] ||= {}
11
+ engine_opts[:sass][:quiet] = engine_opts.delete(:quiet)
12
+ end
13
+ [project_path, sass_path, css_path, engine_opts]
14
+ end
15
+
16
+ def to_sass_plugin_options
17
+ locations = []
18
+ locations << [sass_path, css_path] if sass_path && css_path
19
+ Compass::Frameworks::ALL.each do |framework|
20
+ locations << [framework.stylesheets_directory, File.join(css_path || css_dir || ".", framework.name)]
21
+ end
22
+ plugin_opts = {:template_location => locations}
23
+ plugin_opts[:style] = output_style if output_style
24
+ plugin_opts[:line_comments] = line_comments
25
+ if sass_3_4?
26
+ plugin_opts[:sourcemap] = sourcemap ? :auto : :none
27
+ else
28
+ plugin_opts[:sourcemap] = sourcemap
29
+ end
30
+ plugin_opts[:cache] = cache unless cache.nil?
31
+ plugin_opts[:cache_location] = cache_path unless cache_path.nil?
32
+ plugin_opts[:quiet] = disable_warnings if disable_warnings
33
+ plugin_opts[:compass] = {}
34
+ plugin_opts[:compass][:environment] = environment
35
+ plugin_opts.merge!(sass_options || {})
36
+ plugin_opts[:load_paths] ||= []
37
+ plugin_opts[:load_paths] += resolve_additional_import_paths
38
+ # TODO: When sprites are extracted to their own plugin, this
39
+ # TODO: will need to be extracted to there.
40
+ if defined?(Compass::SpriteImporter.new)
41
+ plugin_opts[:load_paths] << Compass::SpriteImporter.new
42
+ end
43
+ plugin_opts[:full_exception] = (environment == :development)
44
+ plugin_opts
45
+ end
46
+
47
+ def resolve_additional_import_paths
48
+ (additional_import_paths || []).map do |path|
49
+ if path.is_a?(String) && project_path && !absolute_path?(path)
50
+ File.join(project_path, path)
51
+ else
52
+ path
53
+ end
54
+ end
55
+ end
56
+
57
+ def absolute_path?(path)
58
+ # Pretty basic implementation
59
+ path.index(File::SEPARATOR) == 0 || path.index(':') == 1
60
+ end
61
+
62
+ def to_sass_engine_options
63
+ engine_opts = {:load_paths => sass_load_paths}
64
+ engine_opts[:style] = output_style if output_style
65
+ engine_opts[:line_comments] = line_comments
66
+ if sass_3_4?
67
+ engine_opts[:sourcemap] = sourcemap ? :auto : :none
68
+ else
69
+ engine_opts[:sourcemap] = sourcemap
70
+ end
71
+ engine_opts[:cache] = cache
72
+ engine_opts[:cache_location] = cache_path
73
+ engine_opts[:quiet] = disable_warnings if disable_warnings
74
+ engine_opts[:compass] = {}
75
+ engine_opts[:compass][:environment] = environment
76
+ engine_opts[:full_exception] = (environment == :development)
77
+ engine_opts.merge!(sass_options || {})
78
+ end
79
+
80
+ def sass_load_paths
81
+ load_paths = []
82
+ load_paths << sass_path if sass_path && File.directory?(sass_path)
83
+ Compass::Frameworks::ALL.each do |f|
84
+ load_paths << f.stylesheets_directory if File.directory?(f.stylesheets_directory)
85
+ end
86
+ importer = sass_options[:filesystem_importer] if sass_options && sass_options[:filesystem_importer]
87
+ importer ||= Sass::Importers::Filesystem
88
+ load_paths += resolve_additional_import_paths
89
+ load_paths.map! do |p|
90
+ next p if p.respond_to?(:find_relative)
91
+ importer.new(p.to_s)
92
+ end
93
+ # TODO: When sprites are extracted to their own plugin, this
94
+ # TODO: will need to be extracted to there.
95
+ if defined?(Compass::SpriteImporter.new)
96
+ load_paths << Compass::SpriteImporter.new
97
+ end
98
+ load_paths
99
+ end
100
+
101
+ def sass_3_4?
102
+ Sass.version[:major] == 3 && Sass.version[:minor] == 4
103
+ end
104
+ end
105
+ class Data
106
+ include Adapters
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,199 @@
1
+ module Compass
2
+ module Configuration
3
+ # The Compass configuration data storage class manages configuration data that comes from a variety of
4
+ # different sources and aggregates them together into a consistent API
5
+ # Some of the possible sources of configuration data:
6
+ # * Compass default project structure for stand alone projects
7
+ # * App framework specific project structures for rails, etc.
8
+ # * User supplied explicit configuration
9
+ # * Configuration data provided via the command line interface
10
+ #
11
+ # There are two kinds of configuration data that doesn't come from the user:
12
+ #
13
+ # 1. Configuration data that is defaulted as if the user had provided it themselves.
14
+ # This is useful for providing defaults that the user is likely to want to edit
15
+ # but shouldn't have to provide explicitly when getting started
16
+ # 2. Configuration data that is defaulted behind the scenes because _some_ value is
17
+ # required.
18
+ class Data
19
+
20
+ attr_reader :name
21
+ extend Sass::Callbacks
22
+
23
+
24
+ include Compass::Configuration::Inheritance
25
+ extend Compass::Configuration::Paths
26
+
27
+ # on_sprite_saved
28
+ # yields the filename
29
+ # usage: on_sprite_saved {|filename| do_something(filename) }
30
+ define_callback :sprite_saved
31
+ chained_method :run_sprite_saved
32
+
33
+ # on_sprite_generated
34
+ # yields 'ChunkyPNG::Image'
35
+ # usage: on_sprite_generated {|sprite_data| do_something(sprite_data) }
36
+ define_callback :sprite_generated
37
+ chained_method :run_sprite_generated
38
+
39
+ # on_sprite_removed
40
+ # yields the filename
41
+ # usage: on_sprite_removed {|filename| do_something(filename) }
42
+ define_callback :sprite_removed
43
+ chained_method :run_sprite_removed
44
+
45
+ # on_stylesheet_saved
46
+ # yields the filename
47
+ # usage: on_stylesheet_saved {|filename| do_something(filename) }
48
+ define_callback :stylesheet_saved
49
+ chained_method :run_stylesheet_saved
50
+
51
+ # on_sourcemap_saved
52
+ # yields the filename
53
+ # usage: on_sourcemap_saved {|filename| do_something(filename) }
54
+ define_callback :sourcemap_saved
55
+ chained_method :run_sourcemap_saved
56
+
57
+ # on_stylesheet_removed
58
+ # yields the filename
59
+ # usage: on_stylesheet_removed {|filename| do_something(filename) }
60
+ define_callback :stylesheet_removed
61
+ chained_method :run_stylesheet_removed
62
+
63
+ # on_sourcemap_removed
64
+ # yields the filename
65
+ # usage: on_sourcemap_removed {|filename| do_something(filename) }
66
+ define_callback :sourcemap_removed
67
+ chained_method :run_sourcemap_removed
68
+
69
+ # on_stylesheet_error
70
+ # yields the filename & message
71
+ # usage: on_stylesheet_error {|filename, message| do_something(filename, message) }
72
+ define_callback :stylesheet_error
73
+ chained_method :run_stylesheet_error
74
+
75
+ inherited_accessor(*ATTRIBUTES)
76
+
77
+ strip_trailing_separator(*ATTRIBUTES.select{|a| a.to_s =~ /dir|path/})
78
+
79
+ ARRAY_ATTRIBUTES.each do |array_attr|
80
+ inherited_array(array_attr, ARRAY_ATTRIBUTE_OPTIONS.fetch(array_attr, {}))
81
+ end
82
+
83
+ def initialize(name, attr_hash = nil)
84
+ raise "I need a name!" unless name
85
+ @name = name
86
+ set_all(attr_hash) if attr_hash
87
+ self.top_level = self
88
+ end
89
+
90
+ def set_all(attr_hash)
91
+ attr_hash.each do |a, v|
92
+ if self.respond_to?("#{a}=")
93
+ self.send("#{a}=", v)
94
+ end
95
+ end
96
+ end
97
+
98
+ def add_import_path(*paths)
99
+ paths.map!{|p| defined?(Pathname) && Pathname === p ? p.to_s : p}
100
+ # The @added_import_paths variable works around an issue where
101
+ # the additional_import_paths gets overwritten during parse
102
+ @added_import_paths ||= []
103
+ @added_import_paths += paths
104
+ paths.each do |p|
105
+ self.additional_import_paths << p unless additional_import_paths.include?(p)
106
+ end
107
+ end
108
+
109
+ # When called with a block, defines the asset host url to be used.
110
+ # The block must return a string that starts with a protocol (E.g. http).
111
+ # The block will be passed the root-relative url of the asset.
112
+ # When called without a block, returns the block that was previously set.
113
+ def asset_host(&block)
114
+ @set_attributes ||= {}
115
+ if block_given?
116
+ @set_attributes[:asset_host] = true
117
+ @asset_host = block
118
+ else
119
+ if @asset_host
120
+ @asset_host
121
+ elsif inherited_data.respond_to?(:asset_host)
122
+ inherited_data.asset_host
123
+ end
124
+ end
125
+ end
126
+
127
+ # When called with a block, defines the cache buster strategy to be used.
128
+ # If the block returns nil or a string, then it is appended to the url as a query parameter.
129
+ # In this case, the returned string must not include the starting '?'.
130
+ # The block may also return a hash with :path and/or :query values and it
131
+ # will replace the original path and query string with the busted values returned.
132
+ # The block will be passed the root-relative url of the asset.
133
+ # If the block accepts two arguments, it will also be passed a File object
134
+ # that points to the asset on disk -- which may or may not exist.
135
+ # When called without a block, returns the block that was previously set.
136
+ #
137
+ # To disable the asset cache buster:
138
+ #
139
+ # asset_cache_buster :none
140
+ def asset_cache_buster(simple = nil, &block)
141
+ @set_attributes ||= {}
142
+ if block_given?
143
+ @set_attributes[:asset_cache_buster] = true
144
+ @asset_cache_buster = block
145
+ elsif !simple.nil?
146
+ if simple == :none
147
+ @set_attributes[:asset_cache_buster] = true
148
+ @asset_cache_buster = Proc.new {|_,_| nil}
149
+ else
150
+ raise ArgumentError, "Unexpected argument: #{simple.inspect}"
151
+ end
152
+ else
153
+ if set?(:asset_cache_buster)
154
+ @asset_cache_buster
155
+ elsif inherited_data.respond_to?(:asset_cache_buster)
156
+ inherited_data.asset_cache_buster
157
+ end
158
+ end
159
+ end
160
+
161
+ def watch(glob, &block)
162
+ @watches ||= []
163
+ @watches << Watch.new(glob, &block)
164
+ end
165
+
166
+ def watches
167
+ if defined?(@watches)
168
+ @watches
169
+ elsif inherited_data.respond_to?(:watches)
170
+ inherited_data.watches
171
+ else
172
+ []
173
+ end
174
+ end
175
+
176
+ # Require a compass plugin and capture that it occured so that the configuration serialization works next time.
177
+ def require(lib)
178
+ (self.required_libraries ||= []) << lib
179
+ super
180
+ end
181
+
182
+ def load(framework_dir)
183
+ (self.loaded_frameworks ||= []) << framework_dir
184
+ Compass::Frameworks.register_directory framework_dir
185
+ end
186
+
187
+ # Finds all extensions within a directory and registers them.
188
+ def discover(frameworks_dir)
189
+ (self.framework_path ||= []) << frameworks_dir
190
+ Compass::Frameworks.discover frameworks_dir
191
+ end
192
+
193
+ def relative_assets?
194
+ # the http_images_path is deprecated, but here for backwards compatibility.
195
+ relative_assets || http_images_path == :relative
196
+ end
197
+ end
198
+ end
199
+ end