compass 0.13.alpha.4 → 0.13.alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +7 -0
  2. data/README.markdown +2 -3
  3. data/Rakefile +91 -5
  4. data/VERSION.yml +1 -1
  5. data/examples/compass/images/emblem-a043c4f148.png +0 -0
  6. data/examples/compass/images/flag-03c3b29b35.png +0 -0
  7. data/examples/compass/images/flag-21cfbfbfc8.png +0 -0
  8. data/examples/css3/extensions/fancy-fonts/templates/project/Prociono.otf +0 -0
  9. data/features/command_line.feature +2 -6
  10. data/features/step_definitions/command_line_steps.rb +1 -0
  11. data/frameworks/compass/stylesheets/compass/_css3.scss +0 -1
  12. data/frameworks/compass/stylesheets/compass/_support.scss +353 -35
  13. data/frameworks/compass/stylesheets/compass/css3/_animation.scss +49 -48
  14. data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +4 -8
  15. data/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +15 -19
  16. data/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +17 -19
  17. data/frameworks/compass/stylesheets/compass/css3/_background-size.scss +4 -8
  18. data/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +37 -39
  19. data/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +45 -20
  20. data/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +6 -8
  21. data/frameworks/compass/stylesheets/compass/css3/_box.scss +12 -13
  22. data/frameworks/compass/stylesheets/compass/css3/_columns.scss +46 -26
  23. data/frameworks/compass/stylesheets/compass/css3/_deprecated-support.scss +272 -0
  24. data/frameworks/compass/stylesheets/compass/css3/_filter.scss +17 -10
  25. data/frameworks/compass/stylesheets/compass/css3/_flexbox.scss +134 -281
  26. data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +5 -5
  27. data/frameworks/compass/stylesheets/compass/css3/_hyphenation.scss +14 -11
  28. data/frameworks/compass/stylesheets/compass/css3/_images.scss +77 -67
  29. data/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +15 -6
  30. data/frameworks/compass/stylesheets/compass/css3/_opacity.scss +6 -2
  31. data/frameworks/compass/stylesheets/compass/css3/_pie.scss +1 -73
  32. data/frameworks/compass/stylesheets/compass/css3/_regions.scss +7 -6
  33. data/frameworks/compass/stylesheets/compass/css3/_selection.scss +45 -17
  34. data/frameworks/compass/stylesheets/compass/css3/_shared.scss +4 -261
  35. data/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +1 -1
  36. data/frameworks/compass/stylesheets/compass/css3/_transform.scss +24 -32
  37. data/frameworks/compass/stylesheets/compass/css3/_transition.scss +102 -152
  38. data/frameworks/compass/stylesheets/compass/css3/_user-interface.scss +42 -27
  39. data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +2 -1
  40. data/frameworks/compass/stylesheets/compass/typography/links/_hover-link.scss +1 -1
  41. data/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss +2 -2
  42. data/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss +1 -1
  43. data/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss +1 -1
  44. data/frameworks/compass/stylesheets/compass/utilities/_sass.scss +2 -0
  45. data/frameworks/compass/stylesheets/compass/utilities/color/_brightness.scss +12 -0
  46. data/frameworks/compass/stylesheets/compass/utilities/color/_contrast.scss +36 -12
  47. data/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +6 -2
  48. data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +23 -4
  49. data/frameworks/compass/stylesheets/compass/utilities/general/_min.scss +1 -1
  50. data/frameworks/compass/stylesheets/compass/utilities/sass/_lists.scss +16 -0
  51. data/frameworks/compass/stylesheets/compass/utilities/sass/_maps.scss +19 -0
  52. data/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss +25 -18
  53. data/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +3 -1
  54. data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +3 -3
  55. data/lib/compass.rb +1 -1
  56. data/lib/compass/browser_support.rb +1 -1
  57. data/lib/compass/caniuse.rb +247 -0
  58. data/lib/compass/configuration/adapters.rb +7 -1
  59. data/lib/compass/sass_extensions/functions.rb +5 -0
  60. data/lib/compass/sass_extensions/functions/constants.rb +2 -2
  61. data/lib/compass/sass_extensions/functions/cross_browser_support.rb +176 -1
  62. data/lib/compass/sass_extensions/functions/display.rb +24 -19
  63. data/lib/compass/sass_extensions/functions/env.rb +37 -8
  64. data/lib/compass/sass_extensions/functions/gradient_support.rb +10 -13
  65. data/lib/compass/sass_extensions/functions/math.rb +31 -13
  66. data/lib/compass/sass_extensions/functions/sprites.rb +48 -25
  67. data/lib/compass/sass_extensions/monkey_patches/browser_support.rb +42 -13
  68. data/lib/compass/sass_extensions/sprites/image.rb +14 -4
  69. data/lib/compass/sass_extensions/sprites/image_methods.rb +19 -3
  70. data/lib/compass/sprite_importer/content.erb +8 -7
  71. data/lib/compass/watcher/project_watcher.rb +75 -42
  72. data/lib/compass/watcher/watch.rb +35 -17
  73. data/test/fixtures/sprites/public/images/focus/ten-by-ten.png +0 -0
  74. data/test/fixtures/sprites/public/images/focus/ten-by-ten_active.png +0 -0
  75. data/test/fixtures/sprites/public/images/focus/ten-by-ten_focus.png +0 -0
  76. data/test/fixtures/sprites/public/images/focus/ten-by-ten_hover.png +0 -0
  77. data/test/fixtures/sprites/public/images/focus/ten-by-ten_target.png +0 -0
  78. data/test/fixtures/stylesheets/compass/config.rb +1 -0
  79. data/test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css +1 -9
  80. data/test/fixtures/stylesheets/compass/css/animation.css +1 -9
  81. data/test/fixtures/stylesheets/compass/css/appearance.css +3 -0
  82. data/test/fixtures/stylesheets/compass/css/background-clip.css +4 -8
  83. data/test/fixtures/stylesheets/compass/css/background-origin.css +4 -8
  84. data/test/fixtures/stylesheets/compass/css/background-size.css +3 -10
  85. data/test/fixtures/stylesheets/compass/css/border_radius.css +3 -3
  86. data/test/fixtures/stylesheets/compass/css/{box-sizeing.css → box-sizing.css} +2 -2
  87. data/test/fixtures/stylesheets/compass/css/box_shadow.css +15 -5
  88. data/test/fixtures/stylesheets/compass/css/brightness.css +14 -0
  89. data/test/fixtures/stylesheets/compass/css/browser-support.css +306 -0
  90. data/test/fixtures/stylesheets/compass/css/color.css +18 -0
  91. data/test/fixtures/stylesheets/compass/css/columns.css +27 -18
  92. data/test/fixtures/stylesheets/compass/css/filters.css +6 -6
  93. data/test/fixtures/stylesheets/compass/css/flexbox.css +84 -111
  94. data/test/fixtures/stylesheets/compass/css/fonts.css +1 -1
  95. data/test/fixtures/stylesheets/compass/css/gradients.css +53 -53
  96. data/test/fixtures/stylesheets/compass/css/grid_background.css +11 -11
  97. data/test/fixtures/stylesheets/compass/css/hyphenation.css +2 -4
  98. data/test/fixtures/stylesheets/compass/css/lists.css +6 -12
  99. data/test/fixtures/stylesheets/compass/css/regions.css +2 -2
  100. data/test/fixtures/stylesheets/compass/css/selection.css +41 -4
  101. data/test/fixtures/stylesheets/compass/css/sprites_with_explicit_separator.css +16 -0
  102. data/test/fixtures/stylesheets/compass/css/support.css +62 -0
  103. data/test/fixtures/stylesheets/compass/css/transform.css +64 -136
  104. data/test/fixtures/stylesheets/compass/css/transition.css +27 -45
  105. data/test/fixtures/stylesheets/compass/css/typography/links/hover-link.css +4 -0
  106. data/test/fixtures/stylesheets/compass/css/user-interface.css +34 -7
  107. data/test/fixtures/stylesheets/compass/css/utilities.css +7 -7
  108. data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +6 -9
  109. data/test/fixtures/stylesheets/compass/images/flag_states-sc42d7bf926.png +0 -0
  110. data/test/fixtures/stylesheets/compass/images/flag_states/foo.png +0 -0
  111. data/test/fixtures/stylesheets/compass/images/flag_states/foo_active.png +0 -0
  112. data/test/fixtures/stylesheets/compass/images/flag_states/foo_focus.png +0 -0
  113. data/test/fixtures/stylesheets/compass/images/flag_states/foo_hover.png +0 -0
  114. data/test/fixtures/stylesheets/compass/images/flag_states/foo_target.png +0 -0
  115. data/test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss +1 -3
  116. data/test/fixtures/stylesheets/compass/sass/appearance.scss +5 -0
  117. data/test/fixtures/stylesheets/compass/sass/background-clip.scss +0 -5
  118. data/test/fixtures/stylesheets/compass/sass/background-origin.scss +0 -5
  119. data/test/fixtures/stylesheets/compass/sass/background-size.scss +0 -5
  120. data/test/fixtures/stylesheets/compass/sass/{box-sizeing.scss → box-sizing.scss} +1 -1
  121. data/test/fixtures/stylesheets/compass/sass/box_shadow.scss +2 -0
  122. data/test/fixtures/stylesheets/compass/sass/brightness.scss +12 -0
  123. data/test/fixtures/stylesheets/compass/sass/browser-support.scss +30 -0
  124. data/test/fixtures/stylesheets/compass/sass/color.scss +22 -0
  125. data/test/fixtures/stylesheets/compass/sass/filters.scss +1 -0
  126. data/test/fixtures/stylesheets/compass/sass/flexbox.scss +84 -40
  127. data/test/fixtures/stylesheets/compass/sass/gradients.sass +3 -2
  128. data/test/fixtures/stylesheets/compass/sass/selection.scss +29 -4
  129. data/test/fixtures/stylesheets/compass/sass/sprites_with_explicit_separator.scss +7 -0
  130. data/test/fixtures/stylesheets/compass/sass/support.scss +137 -0
  131. data/test/fixtures/stylesheets/compass/sass/transition.scss +0 -3
  132. data/test/fixtures/stylesheets/compass/sass/typography/links/hover-link.scss +3 -0
  133. data/test/fixtures/stylesheets/compass/sass/user-interface.scss +16 -5
  134. data/test/fixtures/stylesheets/compass/sass/utilities.scss +4 -4
  135. data/test/fixtures/stylesheets/envtest/css/env.css +4 -4
  136. data/test/fixtures/stylesheets/envtest/tmp/env.css +4 -4
  137. data/test/integrations/sprites_test.rb +30 -1
  138. data/test/test_helper.rb +2 -2
  139. data/test/units/caniuse_test.rb +115 -0
  140. data/test/units/command_line_test.rb +1 -0
  141. data/test/units/sass_extensions_test.rb +5 -0
  142. data/test/units/sprites/image_test.rb +12 -0
  143. data/test/units/sprites/sprite_map_test.rb +11 -0
  144. data/test/units/watcher/project_watcher_test.rb +26 -18
  145. metadata +96 -42
  146. data/examples/compass/src/pie.scss +0 -110
  147. data/frameworks/compass/stylesheets/compass/css3/_transform-legacy.scss +0 -87
  148. data/frameworks/compass/templates/pie/LICENSE +0 -12
  149. data/frameworks/compass/templates/pie/LICENSE-APACHE2.txt +0 -13
  150. data/frameworks/compass/templates/pie/LICENSE-GPL2.txt +0 -278
  151. data/frameworks/compass/templates/pie/PIE.htc +0 -96
  152. data/frameworks/compass/templates/pie/manifest.rb +0 -39
  153. data/frameworks/compass/templates/pie/pie.scss +0 -74
  154. data/lib/compass/sass_extensions/functions/utility.rb +0 -10
  155. data/test/fixtures/stylesheets/compass/css/pie.css +0 -23
  156. data/test/fixtures/stylesheets/compass/sass/pie.scss +0 -47
@@ -5,6 +5,7 @@ module Compass
5
5
  ACTIVE = %r{[_-]active$}
6
6
  TARGET = %r{[_-]target$}
7
7
  HOVER = %r{[_-]hover$}
8
+ FOCUS = %r{[_-]focus$}
8
9
  PARENT = %r{(.+)[-_](.+)$}
9
10
 
10
11
  REPEAT_X = 'repeat-x'
@@ -114,7 +115,7 @@ module Compass
114
115
 
115
116
  # Hover selector Image object if exsists
116
117
  def hover
117
- base.image_for("#{name}_hover")
118
+ base.get_magic_selector_image(name, 'hover')
118
119
  end
119
120
 
120
121
  # Is target selector
@@ -124,7 +125,7 @@ module Compass
124
125
 
125
126
  # Target selector Image object if exsists
126
127
  def target
127
- base.image_for("#{name}_target")
128
+ base.get_magic_selector_image(name, 'target')
128
129
  end
129
130
 
130
131
  # Is active selector
@@ -134,12 +135,21 @@ module Compass
134
135
 
135
136
  # Active selector Image object if exsists
136
137
  def active
137
- base.image_for("#{name}_active")
138
+ base.get_magic_selector_image(name, 'active')
139
+ end
140
+
141
+ # Is active selector
142
+ def focus?
143
+ name =~ FOCUS
138
144
  end
139
145
 
146
+ # Active selector Image object if exsists
147
+ def focus
148
+ base.get_magic_selector_image(name, 'focus')
149
+ end
140
150
 
141
151
  def parent
142
- if [hover?, target?, active?].any?
152
+ if [hover?, target?, active?, focus?].any?
143
153
  PARENT.match name
144
154
  base.image_for($1)
145
155
  end
@@ -13,19 +13,35 @@ module Compass
13
13
 
14
14
  # Returns true if the image name has a hover selector image
15
15
  def has_hover?(name)
16
- !image_for("#{name}_hover").nil?
16
+ !get_magic_selector_image(name, 'hover').nil?
17
17
  end
18
18
 
19
19
  # Returns true if the image name has a target selector image
20
20
  def has_target?(name)
21
- !image_for("#{name}_target").nil?
21
+ !get_magic_selector_image(name, 'target').nil?
22
+ end
23
+
24
+ # Returns true if the image name has a focus selector image
25
+ def has_focus?(name)
26
+ !get_magic_selector_image(name, 'focus').nil?
22
27
  end
23
28
 
24
29
  # Returns true if the image name has an active selector image
25
30
  def has_active?(name)
26
- !image_for("#{name}_active").nil?
31
+ !get_magic_selector_image(name, 'active').nil?
27
32
  end
28
33
 
34
+ SEPERATORS = ['_', '-']
35
+
36
+ def get_magic_selector_image(name, selector)
37
+ SEPERATORS.each do |seperator|
38
+ file = image_for("#{name}#{seperator}#{selector}")
39
+ return file if !file.nil?
40
+ end
41
+
42
+ nil
43
+ end
44
+
29
45
  # Return and array of image names that make up this sprite
30
46
  def sprite_names
31
47
  image_names.map { |f| File.basename(f, '.png') }
@@ -2,7 +2,6 @@
2
2
 
3
3
  // General Sprite Defaults
4
4
  // You can override them before you import this file.
5
- $<%= name %>-sprite-base-class : ".<%= name %>-sprite" !default;
6
5
  $<%= name %>-sprite-dimensions : false !default;
7
6
  $<%= name %>-use-percentages : false !default;
8
7
  $<%= name %>-position : 0% !default;
@@ -13,6 +12,8 @@ $<%= name %>-clean-up : true !default;
13
12
  $<%= name %>-layout : vertical !default;
14
13
  $<%= name %>-inline : false !default;
15
14
  $<%= name %>-sort-by : 'none' !default;
15
+ $<%= name %>-class-separator : $default-sprite-separator !default;
16
+ $<%= name %>-sprite-base-class : ".<%= name %>#{$<%= name %>-class-separator}sprite" !default;
16
17
 
17
18
  <% if skip_overrides %>
18
19
  $<%= name %>-sprites: sprite-map("<%= uri %>", $layout: $<%= name %>-layout, $cleanup: $<%= name %>-clean-up, $spacing: $<%= name %>-spacing, $position : $<%= name %>-position);
@@ -71,16 +72,16 @@ $<%= name %>-sort-by : 'none' !default;
71
72
 
72
73
  // Extends the sprite base class and set the background position for the desired sprite.
73
74
  // It will also apply the image dimensions if $dimensions is true.
74
- @mixin <%= name %>-sprite($name, $dimensions: $<%= name %>-sprite-dimensions, $offset-x: 0, $offset-y: 0, $use-percentages: $<%= name %>-use-percentages) {
75
+ @mixin <%= name %>-sprite($name, $dimensions: $<%= name %>-sprite-dimensions, $offset-x: 0, $offset-y: 0, $use-percentages: $<%= name %>-use-percentages, $separator: $<%= name %>-class-separator) {
75
76
  @extend #{$<%= name %>-sprite-base-class};
76
- @include sprite($<%= name %>-sprites, $name, $dimensions, $offset-x, $offset-y, $use-percentages);
77
+ @include sprite($<%= name %>-sprites, $name, $dimensions, $offset-x, $offset-y, $use-percentages, $separator: $separator);
77
78
  }
78
79
 
79
- @mixin <%= name %>-sprites($sprite-names, $dimensions: $<%= name %>-sprite-dimensions, $prefix: sprite-map-name($<%= name %>-sprites), $offset-x: 0, $offset-y: 0, $use-percentages: $<%= name %>-use-percentages) {
80
- @include sprites($<%= name %>-sprites, $sprite-names, $<%= name %>-sprite-base-class, $dimensions, $prefix, $offset-x, $offset-y, $use-percentages)
80
+ @mixin <%= name %>-sprites($sprite-names, $dimensions: $<%= name %>-sprite-dimensions, $prefix: sprite-map-name($<%= name %>-sprites), $offset-x: 0, $offset-y: 0, $use-percentages: $<%= name %>-use-percentages, $separator: $<%= name %>-class-separator) {
81
+ @include sprites($<%= name %>-sprites, $sprite-names, $<%= name %>-sprite-base-class, $dimensions, $prefix, $offset-x, $offset-y, $use-percentages, $separator: $separator)
81
82
  }
82
83
 
83
84
  // Generates a class for each sprited image.
84
- @mixin all-<%= name %>-sprites($dimensions: $<%= name %>-sprite-dimensions, $prefix: sprite-map-name($<%= name %>-sprites), $offset-x: 0, $offset-y: 0, $use-percentages: $<%= name %>-use-percentages) {
85
- @include <%= name %>-sprites(<%= sprite_names.join(" ") %>, $dimensions, $prefix, $offset-x, $offset-y, $use-percentages);
85
+ @mixin all-<%= name %>-sprites($dimensions: $<%= name %>-sprite-dimensions, $prefix: sprite-map-name($<%= name %>-sprites), $offset-x: 0, $offset-y: 0, $use-percentages: $<%= name %>-use-percentages, $separator: $<%= name %>-class-separator) {
86
+ @include <%= name %>-sprites(<%= sprite_names.join(" ") %>, $dimensions, $prefix, $offset-x, $offset-y, $use-percentages, $separator: $separator);
86
87
  }
@@ -8,7 +8,7 @@ module Compass
8
8
  ALL_CHILDREN_SASS_FILTER = File.join('**', SASS_FILTER)
9
9
  POLLING_MESSAGE = 'Compass is polling for changes'
10
10
 
11
- attr_reader :options, :project_path, :watcher_compiler, :listener, :poll, :css_dir, :sass_watchers
11
+ attr_reader :options, :project_path, :watcher_compiler, :listener, :poll, :css_dir, :watchers
12
12
 
13
13
  alias :working_path :project_path
14
14
 
@@ -22,83 +22,86 @@ module Compass
22
22
  @options = options
23
23
  @project_path = project_path
24
24
  @css_dir = Compass.configuration.css_dir
25
- @sass_watchers = create_sass_watchers + watches
25
+ @watchers = [SassWatch.new(&method(:sass_callback))] + watches
26
26
  @watcher_compiler = Compass::Watcher::Compiler.new(project_path, options)
27
27
  setup_listener
28
28
  end
29
29
 
30
30
  def watch!
31
- listener.start
31
+ listener.start!
32
32
  rescue Interrupt
33
- log_action(:info, "Good bye!", options)
33
+ logger.log "\nHappy Styling!"
34
34
  listener.stop
35
35
  end
36
36
 
37
37
  private #============================================================================>
38
38
 
39
39
  def setup_listener
40
- @listener = Listen.to(@project_path, :relative_paths => true)
41
- if poll
42
- @listener = listener.force_polling(true)
43
- end
40
+ @listener = Listen::Listener.new(directories_to_watch,
41
+ :relative_paths => false)
42
+ @listener = listener.force_polling(true) if poll
44
43
  @listener = listener.polling_fallback_message(POLLING_MESSAGE)
45
44
  @listener = listener.ignore(/\.css$/)
46
45
  @listener = listener.change(&method(:listen_callback))
47
46
  end
48
47
 
49
- def create_sass_watchers
50
- watches = []
51
- Compass.configuration.sass_load_paths.map do |load_path|
52
- load_path = load_path.root if load_path.respond_to?(:root)
53
- next unless load_path.is_a? String
54
- next unless load_path.include? project_path
55
- load_path = Pathname.new(load_path).relative_path_from(Pathname.new(project_path))
56
- filter = File.join(load_path, SASS_FILTER)
57
- children = File.join(load_path, ALL_CHILDREN_SASS_FILTER)
58
- if filter.match(%r{^./})
59
- watches << Watcher::Watch.new(SASS_FILTER, &method(:sass_callback))
48
+ def directories_to_watch
49
+ [Compass.configuration.sass_path] + Compass.configuration.sass_load_paths.map{|p| p.respond_to?(:root) ? p.root : nil}.compact
50
+ end
51
+
52
+ def listen_callback(modified_files, added_files, removed_files)
53
+ #log_action(:info, ">>> Listen Callback fired added: #{added_files}, mod: #{modified_files}, rem: #{removed_files}", {})
54
+ files = {:modified => modified_files,
55
+ :added => added_files,
56
+ :removed => removed_files}
57
+
58
+ run_once, run_each = watchers.partition {|w| w.run_once_per_changeset?}
59
+
60
+ run_once.each do |watcher|
61
+ if file = files.values.flatten.detect{|f| watcher.match?(f) }
62
+ action = files.keys.detect{|k| files[k].include?(file) }
63
+ watcher.run_callback(project_path, relative_to(file, project_path), action)
60
64
  end
61
- watches << Watcher::Watch.new(filter, &method(:sass_callback))
62
- watches << Watcher::Watch.new(children, &method(:sass_callback))
63
65
  end
64
- watches.compact
65
- end
66
66
 
67
- def listen_callback(modified_file, added_file, removed_file)
68
- #log_action(:info, ">>> Listen Callback fired added: #{added_file}, mod: #{modified_file}, rem: #{removed_file}", {})
69
- action = nil
70
- action ||= :modified unless modified_file.empty?
71
- action ||= :added unless added_file.empty?
72
- action ||= :removed unless removed_file.empty?
73
-
74
- files = modified_file + added_file + removed_file
75
- # run watchers
76
- sass_watchers.each do |watcher|
77
- files.each do |file|
78
- watcher.run_callback(project_path, file, action) if watcher.match?(file)
67
+ run_each.each do |watcher|
68
+ files.each do |action, list|
69
+ list.each do |file|
70
+ if watcher.match?(file)
71
+ watcher.run_callback(project_path, relative_to(file, project_path), action)
72
+ end
73
+ end
79
74
  end
80
75
  end
81
76
  end
82
77
 
83
78
  def sass_callback(base, file, action)
84
79
  #log_action(:info, ">>> Sass Callback fired #{action}, #{file}", {})
85
- sass_modified(file) if action == :modified
86
- sass_added(file) if action == :added
87
- sass_removed(file) if action == :removed
80
+ full_filename = File.expand_path(File.join(base,file))
81
+ case action
82
+ when :modified
83
+ sass_modified(full_filename)
84
+ when :added
85
+ sass_added(full_filename)
86
+ when :removed
87
+ sass_removed(full_filename)
88
+ else
89
+ raise ArgumentError, "Illegal Action: #{action.inspect}"
90
+ end
88
91
  end
89
92
 
90
93
  def sass_modified(file)
91
- log_action(:info, "#{file} was modified", options)
94
+ log_action(:info, "#{filename_for_display(file)} was modified", options)
92
95
  compile
93
96
  end
94
97
 
95
98
  def sass_added(file)
96
- log_action(:info, "#{file} was added", options)
99
+ log_action(:info, "#{filename_for_display(file)} was added", options)
97
100
  compile
98
101
  end
99
102
 
100
103
  def sass_removed(file)
101
- log_action(:info, "#{file} was removed", options)
104
+ log_action(:info, "#{filename_for_display(file)} was removed", options)
102
105
  css_file = compiler.corresponding_css_file(File.join(project_path, file))
103
106
  compile
104
107
  if File.exists?(css_file)
@@ -106,6 +109,36 @@ module Compass
106
109
  end
107
110
  end
108
111
 
112
+ def local_development_locations
113
+ @local_development_locations ||= begin
114
+ r = [Compass.configuration.sass_path] + Array(Compass.configuration.additional_import_paths)
115
+ r.map!{|l| File.expand_path(l) }
116
+ end
117
+ end
118
+
119
+ def filename_for_display(f)
120
+ if local_development_locations.detect{|d| in_directory?(d, f) }
121
+ relative_to_working_directory(f)
122
+ elsif framework = Frameworks::ALL.detect {|framework| in_directory?(framework.stylesheets_directory, f) }
123
+ "(#{framework.name}) #{relative_to(f, framework.stylesheets_directory)}"
124
+ else
125
+ f
126
+ end
127
+ end
128
+
129
+ def in_directory?(dir, f)
130
+ dir && (f[0...(dir.size)] == dir)
131
+ end
132
+
133
+ def relative_to_working_directory(f)
134
+ relative_to(f, Dir.pwd)
135
+ end
136
+
137
+ def relative_to(f, dir)
138
+ Pathname.new(f).relative_path_from(Pathname.new(dir))
139
+ rescue ArgumentError # does not share a common path.
140
+ f
141
+ end
109
142
  end
110
143
  end
111
- end
144
+ end
@@ -1,33 +1,51 @@
1
1
  module Compass
2
2
  module Watcher
3
- class Watch
4
- attr_reader :callback, :glob
3
+ class BasicWatch
4
+ attr_reader :callback
5
5
 
6
- def initialize(glob, &block)
6
+ def initialize(&block)
7
+ unless block
8
+ raise NoCallbackError, "A Block must be supplied in order to be watched"
9
+ end
7
10
  @callback = block
8
- @glob = glob
9
- verify!
10
- end
11
-
12
- def match?(changed_path)
13
- File.fnmatch(glob, changed_path)
14
11
  end
15
12
 
16
13
  def run_callback(base, relative, action)
17
14
  callback.call(base, relative, action)
18
15
  end
19
16
 
20
- private
17
+ def run_once_per_changeset?
18
+ false
19
+ end
21
20
 
22
- def verify!
23
- if Pathname.new(glob).absolute?
24
- raise AbsolutePathError, "Only paths relative to the project can be watched"
25
- end
26
- if callback.nil?
27
- raise NoCallbackError, "A Block must be supplied in order to be watched"
21
+ def match?(path)
22
+ Sass::Util.abstract(self)
23
+ end
24
+ end
25
+
26
+ class Watch < BasicWatch
27
+ attr_reader :glob
28
+
29
+ def initialize(glob, &block)
30
+ super(&block)
31
+ unless glob
32
+ raise WatcherException, "A glob must be supplied in order to be watched"
28
33
  end
34
+ @glob = glob
29
35
  end
30
36
 
37
+ def match?(changed_path)
38
+ File.fnmatch(glob, changed_path)
39
+ end
40
+ end
41
+
42
+ class SassWatch < BasicWatch
43
+ def match?(path)
44
+ path =~ /s[ac]ss$/
45
+ end
46
+ def run_once_per_changeset?
47
+ true
48
+ end
31
49
  end
32
50
  end
33
- end
51
+ end
@@ -1,4 +1,5 @@
1
1
  # Require any additional compass plugins here.
2
+ require 'true'
2
3
  project_type = :stand_alone
3
4
  css_dir = "tmp"
4
5
  sass_dir = "sass"
@@ -12,13 +12,6 @@
12
12
  50% {
13
13
  opacity: 0; } }
14
14
 
15
- @-o-keyframes test {
16
- 0%, 100% {
17
- opacity: 1; }
18
-
19
- 50% {
20
- opacity: 0; } }
21
-
22
15
  @keyframes test {
23
16
  0%, 100% {
24
17
  opacity: 1; }
@@ -27,7 +20,6 @@
27
20
  opacity: 0; } }
28
21
 
29
22
  .animation {
30
- -webkit-animation: test;
31
23
  -moz-animation: test;
32
- -o-animation: test;
24
+ -webkit-animation: test;
33
25
  animation: test; }
@@ -12,13 +12,6 @@
12
12
  50% {
13
13
  background-color: blue; } }
14
14
 
15
- @-o-keyframes test {
16
- 0%, 100% {
17
- background-color: red; }
18
-
19
- 50% {
20
- background-color: blue; } }
21
-
22
15
  @keyframes test {
23
16
  0%, 100% {
24
17
  background-color: red; }
@@ -27,7 +20,6 @@
27
20
  background-color: blue; } }
28
21
 
29
22
  .animation {
30
- -webkit-animation: test;
31
23
  -moz-animation: test;
32
- -o-animation: test;
24
+ -webkit-animation: test;
33
25
  animation: test; }
@@ -0,0 +1,3 @@
1
+ .searchfield {
2
+ -moz-appearance: searchfield;
3
+ -webkit-appearance: searchfield; }
@@ -1,15 +1,11 @@
1
1
  .background-clip {
2
- -webkit-background-clip: border;
3
2
  -moz-background-clip: border;
3
+ -o-background-clip: border-box;
4
+ -webkit-background-clip: border;
4
5
  background-clip: border-box; }
5
6
 
6
7
  .background-clip-multiple {
7
- -webkit-background-clip: border, padding, content;
8
8
  -moz-background-clip: border, padding, content;
9
+ -o-background-clip: border-box, padding-box, content-box;
10
+ -webkit-background-clip: border, padding, content;
9
11
  background-clip: border-box, padding-box, content-box; }
10
-
11
- .background-clip-khtml {
12
- -webkit-background-clip: border;
13
- -moz-background-clip: border;
14
- -khtml-background-clip: border-box;
15
- background-clip: border-box; }